Ssd 1306 oled display


Active member
Hello I am hoping someone could help me out with my code. I can't seem to get both texts to
display at the same time. The smaller "STANDBY" text shows, but the larger text which displays
the transponder code will blink for a half a second then doesn't show.

This code is using datarefs coming in from xplane 11. When I comment out everything for the "STANDBY" text
then the larger transponder code shows up. But I can't seem to get both at the same time, which is what I need.
Any help would be appreciated.



    1.2 KB · Views: 35
No, clearDisplay literally clears everything in the video buffer. Noting that this particular display driver uses part of your Teensy memory as the video buffer. I see you have this call in your update_xpndr function. Clearing the display before drawing text will cause flickering. If you are OK, i'm OK, but there are other ways to draw text w/o flicking. Try setting the background color on the setTextColor method. It's been years since i've used these displays but I'm pretty sure this will work

display.setCursor(20, 35);
display.setTextColor(SSD1306_WHITE, SSD1306_BLACK); // at least I think that is the color def for black

Also, if MODE_SELECT != 1 then you will need to clear the printed text "STANDBY" a few ways to do this down and dirty is to draw a box over the text, something like this:

if (MODE_SELECTOR != 1) {

display.fillRect(10,5,50,10,SSD1306_BLACK); // you may need to mess with the screen coordinates to get the box to draw over the text.


Hope this helps.
Hey Kris, I tried adding the BLACK to the text but that doesn't work. I rewrote the code. I can get STANDBY AND ALT OFF
to work great with a switch. No problem there. I just can't get the text to show up from the val info coming from xplane.
When I turn the transponder knobs in xplane, the text shows up but for only like half a second. Has to be something
simple I'm missing? I added new code.


    2.7 KB · Views: 30
Actually your text displays probably displays for 50 milliseconds. You are clearing the display in the mode selector so your display will get cleared (of course depending on button states). Since your stand by text and alt off test write over each other, I don't think you need cleardisplay, comment it out.
Hey Kris, if I don't clear display before then the transponder code just runs on top of its self and turns into a mess.
But I think I'm just gonna scrap getting the dataref info from xplane and just assign the switches to a digit. It's the
long way to do it but it will work. Thanks for your time. By the way would you know how I could get a seven segment display
Hi I finally got it working perfectly. I've attached the working code. Hopefully this will help someone. Thanks for your time Kris.



    3.9 KB · Views: 33