I got an 16x2 OLED Display (DEP 16201-Y , compatible to the HD44780 controller) for my Arduino Uno and I got it to work in 4-bit Mode.
Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
void setup()
{
//lcd.clear();
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Hello there");
delay(1000);
}
void loop()
{
lcd.setCursor(0,1);
lcd.print("Hello World");
lcd.setCursor(0,0);
lcd.print("ABCDEFGHIJKLM");
delay(1800);
lcd.clear();
}
I'm using the LiquidCrystal library as it is written for this controller.
The code is uploaded to the Arduino and now I power it via a normal power supply with 9V. Then it is pure luck at which position the Text appears. Most of the times at the programmed position but sometimes the hole text is shifted to the right or to the left.
In read in the .cpp file and it says, that the display won't be reseted when the Arduino is reset, so I assume the problem lays there, but I don't know how to fix it.
Thanks!
delay(1000)
in setup(). Was that a copy/paste error or a bug?