first oled_textbox not displaying when running two differant textboxes.

I’m having a problem with an oled_textbox.

I have two text boxes on screen. the bottom “keys” appear properly but the main textbox doesn’t show anything if I have text.clear() at the beginning before I start writing to textbox called text. The other textbox called foot doesn’t seem to have this problem. if I comment out the text.clear(); then the main text appears (but scrolls as the program loops). I need it to clear each time as some screens will have dynamic data shown on them (readings from temp and humidity sensors etc).

I know it’s not an issue with sensor readings or keypad.

below is the oled setup and the display screen code.

// ********************* prep oled screen and load libraries
#include <SPI.h>   //libraries to include in compiled software
#include <math.h>
#include <SD.h>
#include <FTOLED.h>
#include <fonts/SystemFont5x7.h>    // small text
#include <fonts/Arial_Black_16.h>   // big text
const byte pin_cs = 27;
const byte pin_dc = 25;
const byte pin_reset = 3;

OLED oled(pin_cs, pin_dc, pin_reset);

OLED_TextBox text(oled, 0, 24, 128, 128);
OLED_TextBox foot(oled, 0, 0, 128, 24);

Display screen part.

 if (menu == 1)
  {
   //text.clear();
    text.println(" ***  HOME ***");
    text.println(" ");
    text.println(" home screen");
    foot.clear();
    foot.println("2-Weathr 3-Atmos");
    foot.println("4-Compas 5-Clock");
    foot.print ("        9-Alarms");
  }
  else if (menu == 2)
  {

    text.clear();
    text.println(" temp and humidity");

    foot.clear();
    foot.println("2-Weathr 3-Atmos");
    foot.println("4-Compas 5-Clock");
    foot.print ("        9-Alarms");
  }

Since you are certain what the problem IS, it should be trivial for you to fix.

If you reconsider, and decide that you aren't so certain after all, and post ALL the code, with links to the libraries being used, then possibly we could help you.

Hi,

Attached below is the while script.

OLED Library - freetronics

All other libraries obtained through library manager in the arduino IDE

The reason why I think it’s something to do with the display code is when I remove text.clear(); the content of that text box appears but effectivly scrolls as the screen refreshes as new lines are printed.

the second text box called foot performs perfectly.

pem_0p102.ino.ino.ino (9.63 KB)

Attached below is the while script.

I guess that you are using Windows with "hide extensions" turned on

No. I have extensions visable. Seeing thenm makes it easier to distinguish between differant image file format types. The reason why It ended up being .ino.ino.ino was when I went save as and then save as for progressive saves. I do manual progressive saves in software such as photoshop and the IDE so it's easier to revert to an earlier version if things don't work out.

If I only have one text box, that operates correctly, but with two text boxes the first does not show content if I text.clear() to clear it's "screen", The reason for the two text boxes is I don't have to have the same info in each option of a if... else if chain thus saving storage memory and can move the key options to above this bit of code.

I would have replied when I got home from work but been playing with a new 3d pen

I do manual progressive saves from the IDE too but simply add a version number suffix to the filename. Using your scheme you could end up with a filename of say myfile.ino.ino.ino.ino.ino.ino.ino.ino.ino.ino after 10 version. Whilst that may work it looks very clumsy.

I think it might be a bug in the ide as no other software does that (the nearest is PS when I go save as... and it puts the word "copy" into the filename).

I still havn't figures out why my oled textbox "text" doesn't work properly when "foot" does. I do have a backup plan of using a function for the foot and only having one textbox (text box as one word is deliberate as it's written thatway when setting them up) which means I have to watch the amount of screen realestate I use on each "screen"

I've come up with a work-a-round to achieve the same result with only one textbox. However I have to make sure each "screen has exactly the same number of on-screen lines of text (blank lines included), and use a function to do the footer(bottom 4 lines)which is called by all "screens"

footer function: [codevoid footer() { text.println("-------------------"); text.println("2-Weathr 3-Atmos"); text.println("4-Compas 5-Clock"); text.print (" 9-Alarms"); }][/code]

piece of code for one "screen"

 if (menu == 1)
  {
    text.clear();
    text.println("1  ***  HOME ***");
    text.println(" 2");
    text.println("3  home screen");
     text.println("4 ");
      text.println(" 5");
       text.println(" 6");
        text.println("7 ");
         text.println(" 8");
          text.println(" 9");
           text.println(" 10");
         text.println("11 body ");
   footer();
  }