1

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!

4
  • I've indented your code (difficult to read & follow without it). Added missing ';' after the delay(1000) in setup(). Was that a copy/paste error or a bug?
    – JRobert
    Commented Jul 27, 2017 at 12:28
  • I have had a similar module which has displayed similar problems - randomly the lines would swap over on a whim. The best I could get was to control the power to the module to give it a power cycle when needed. I gave up on it in the end, it seems to be an inherent problem with these displays.
    – Majenko
    Commented Jul 27, 2017 at 12:34
  • @JRobert just a copy/paste error. Code works fine :) Thanks!
    – Niklas
    Commented Jul 27, 2017 at 12:35
  • Same cause and solution as: arduino.stackexchange.com/questions/43080/…
    – Majenko
    Commented Jul 27, 2017 at 15:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.