Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Ssd 1306 oled display

  1. #1

    Ssd 1306 oled display

    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.

    Attached Files Attached Files

  2. #2
    You have a .clearDisplay() in both sections. Wont the "Standby" text erase the other?

  3. #3
    Don't I have to clear the buffer before displaying anything?

  4. #4
    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.

  5. #5
    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.
    Attached Files Attached Files

  6. #6
    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.

  7. #7
    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

  8. #8
    What do you mean "mess" can you post a picture?

  9. #9
    Hi I finally got it working perfectly. I've attached the working code. Hopefully this will help someone. Thanks for your time Kris.

    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts