SALE TODAY! 15% off! Use the code BLACKFRIDAY15 on checkout *some restrictions apply.

128x32 I2C OLED "Blinks" during refresh
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

128x32 I2C OLED "Blinks" during refresh

by JasonM132 on Tue Nov 13, 2012 9:53 am

Now I'm pretty sure this is normal, but being a complete novice with this coding system I'm not sure how to get around the screen blinking during the loop or refresh period of the code.

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:

#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!");

int pot = 0;
int val;

void setup()

void loop()

val = map(analogRead(2), 0, 1023, 0, 20);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)



I know the code is probably a mess! go easy on me it's my first time ;)
Posts: 1
Joined: Fri Nov 09, 2012 1:00 pm

Re: 128x32 I2C OLED "Blinks" during refresh

by Corwyn on Fri Nov 23, 2012 2:25 pm

Instead of clearing the whole screen on each iteration of the loop, just clear the part that is changing (by writing spaces). It also looks like you are initializing the screen in every loop. That should probably be in the setup code.
User avatar
Posts: 14
Joined: Mon Nov 05, 2012 8:38 pm

Please be positive and constructive with your questions and comments.