I have an Arduino Uno connected to a LCD. When I try to write to it using the LCD library and the following sketch, it will keep shifting the output around, sometimes drastically.
The sketch:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 10, 11, 9, 8, 7, 6, 5, 4, 3, 2);
void setup ()
{
lcd.begin (16, 2);
}
void loop ()
{
lcd.clear ();
lcd.home ();
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 16; j++)
{
lcd.setCursor (j, i);
lcd.print ("s");
}
}
delay (1000);
}
You would expect it to print
SSSSSSSSSSSSSSSS
SSSSSSSSSSSSSSSS
But it will often print
SSSSSSSSSSSSSSS
SSSSSSSSSSSSSSS
As in, it skips the first line. And, occasionally, it will even print like this:
SSSSSSSSSSS
SSSSSSSSSSS
Is it the LCD's fault, or might there be something wrong with the way it is connected?
EDIT: It is a common Hitachi HD44780-compatible LCD.