What I'm doing (or trying to do) is to keep a constantly updated number value displayed on the OLED that is generated from a 100mm soft-pot. I've got the code itself working with the pot but am trying to find a work-around to keep the screen from blinking during every update of the pot. Here's the code I'm working with:
I know the code is probably a mess! go easy on me it's my first time#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
int pot = 0;
int val;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = map(analogRead(2), 0, 1023, 0, 20);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("SoftPot");
display.setTextSize(3);
display.setTextColor(WHITE);
display.print(val);
display.display();
delay(100);}