Clearing a line on OLED adafruit ssd1306

I print a line at cursor location (0, 0). I want to over right just that line without affecting the remaining lines. How do I do that?

It keeps writing on the top of information that was previously there. If I use the clear command, it erases all lines on the display.

This should be easy I'm sure but I have tried to look it up and stumble through to no avail.

rrfisher: I print a line at cursor location (0, 0). I want to over right just that line without affecting the remaining lines. How do I do that?

It keeps writing on the top of information that was previously there. If I use the clear command, it erases all lines on the display.

This should be easy I'm sure but I have tried to look it up and stumble through to no avail.

did you try printing empty spaces over the line before you re-print it?

That library defaults to transparent writing, which is generally what you want with graphics. To do what you want you should set the background color to something different than the foreground color. By default, they are both set to the same color (black) which the library uses as a flag to mean no background, i.e. transparent. To have black text and a white background just call setTextColor(0xFFFF, 0). At least I think that's what would work.

By the way, if you're just writing text (no graphics), there is a library that you could use instead that is much smaller, uses almost no RAM and is faster: https://github.com/greiman/SSD1306Ascii

I tried to over right using " " spaces but that did not work.

Couldn't see why the spelling looked so weird. Guess I should use write not right. Wow, wonder why I'm having trouble. Too much going on.

jboyton was dead on. Worked like a charm when you enter the line correctly!!!

having the same issue as the OP so stumbled across this thread. Tried jboyton's fix

(//display.setTextColor(0xFFFF, 0);

but it just shows a all black display with no pixels illuminated?

display.setTextColor(BLUE, BLACK);

OLED 128*64

If you have text size = 1 character height will be 7 pixel.
So if you want to clear first row you could do this :

for (y=0; y<=6; y++)
      {
       for (x=0; x<127; x++)
       {
        OLED.drawPixel(x, y, BLACK); 
       }
      }

Works for me very well.

dtokez: having the same issue as the OP so stumbled across this thread. Tried jboyton's fix

(//display.setTextColor(0xFFFF, 0);

but it just shows a all black display with no pixels illuminated?

Instead of

(display.setTextColor(0xFFFF, 0);

try

(display.setTextColor(WHITE, BLACK);

instead. This worked for me with a monochrome display.