OLED Flashing positive text to negative text

Hello

I have a 128X64 OLED from ebay current constructor (U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0))

What I would like to do is put text up on the screen that flashes 'text pixels on' 'rest of screen pixels off' then after a short delay 'text pixels off' 'remaining screen pixels on'. In a kind of warning positive to negative flashing sequence. Any one know of a way to do that. I'm having trouble with the negative text.

Ideas or Example text is very welcome.

Thanks

Hi.

Please confirm that what you are looking for, is the entire display to invert, and that you have the display working right now, actually as a SSD1306.
If so, you can send a simple command to do that (inverse display on and another to switch that off).
I have that on another PC, perhaps later today i can search for that (it's too hot around here to be bothered right now, to be honest).

The commands for the SSD1306 are 0xA6 (normal) and 0xA7 (reverse).

I would first check to see if u8glib has a method for doing this. But if not, you could just send the bytes over I2C yourself.

Hello MAS3, Hope it cools down soon. Yes all is functioning normally. If you have an example great.

Hello Jboyton. Thanks I didn't see anything so far that does it through U8glib. may be wrong. I will try the hex code suggested and give feedback thanks.

It is not so clear to me, what you want to do, but i guess it could also be done by writing a full screen box and inverted text with u8glib.

Oliver

Solved jboyton: Worked thanks applied similar code to this now the screen flashes to alert that the door is open.

void DoorSw() {

u8g.firstPage();
do {

u8g.setFont(u8g_font_courB18r);
u8g.drawStr( 12, 18, "GARAGE");
u8g.drawStr( 23, 36, "DOOR");
u8g.drawStr( 8, 56, " OPEN");
Wire.beginTransmission(OLED_I2C_ADDRESS);
Wire.write(OLED_CONTROL_BYTE_CMD_STREAM);
Wire.write(0xA7);
Wire.endTransmission();
} while( u8g.nextPage() );

delay (1000);

u8g.firstPage();
do {

u8g.setFont(u8g_font_courB18r);
u8g.drawStr( 12, 18, "GARAGE");
u8g.drawStr( 23, 36, "DOOR");
u8g.drawStr( 8, 56, " OPEN");
Wire.beginTransmission(OLED_I2C_ADDRESS);
Wire.write(OLED_CONTROL_BYTE_CMD_STREAM);
Wire.write(0xA6);
Wire.endTransmission();
} while( u8g.nextPage() );
}

1 Like

Nice, well done.

Now you're done with the proof of concept, go find out how to do this a bit more efficient, and dump the delay (all delays).
And get used to doing things that way in the future.
Will save you lots of timing trouble.