16x2 oled display cursor problem

Hello,

This is not so much a problem, just what I find :-


/* Demonstrates problem when using 16x2 oled display marked EH1602A REV J

  • with an Arduino Mega using library Adafruit_CharacterOLED.h.
  1. Put the lcd.clear in place of lcd.home and cursor pointer is not returned to 0,0,

  2. Uncomment lcd.cursor and the display diappears.
    */

#include <Adafruit_CharacterOLED.h>

Adafruit_CharacterOLED lcd(OLED_V2, 36, 35, 34, 33, 32, 31, 30);

void setup() {
lcd.begin(16,2);
}

void loop()
{
lcd.home();
//lcd.clear();

//lcd.cursor();
lcd.print("Display 1 ");
delay(1000);

lcd.setCursor(0,0);
lcd.print("Message 2" );
delay(1000);
}


Does anyone find similar.

Thanks.

Have you looked at the source code for the library? In typical Adafruit fashion, there are many functions to seeming achieve the same goal, with comments that don't match the code, and levels of indirection, and code that appears incomplete.

home() claims to return the cursor position to 0. Well, that's a stupid statement, since the cursor is at some row and some column, which means the describing it's position requires TWO values. 0 is not two values.

setCursor() takes to arguments, and determines if the specified row is valid. If not, the comment says "//write to first line if out off bounds". But that is nonsense, because setCursor() doesn't write anything to the LCD.

It is not clear what your problem is. Do NOT put your problem in the code.