Hi folks. I'm using an arduino UNO to drive this 16x2 LCD display - apparently well-known to the arduino people, as there is the 'liquidcrystal' library for it.
I'm running a very short and simple arduino sketch program for testing the display, and I'm using the '4-bit' data transfer method.
I've encountered 1 issue so far.
First.... what does work?
Well....I can make the LCD print "Hello LCD!!" on row 0 (ie. the top row). And I can also make it print "Hello LCD!!" on row 1 (ie. the bottom row). But the printing of those characters only work properly if I start printing at column '1' (which is physically the 'second' column).
Photo above: Start of print at column '1' (second-column from left) - no problem.
Now....what does not work?
Garbled characters are displayed if I try to print "Hello LCD!!" with the cursor initially set at column 0 (ie. physically the left-most column). That is, attempts to start the print at the left-most column (column '0') results in the same garbled pattern - regardless of which row I do the printing. The same pattern is displayed even when I reset the arduino. This is the issue I'm trying to sort out at the moment.
Photo above: Start of print at column 0 (left-most column) results in garbled characters.
I'll post my very short and simple code..... below. Can somebody let me know if I'm leaving out crucial steps? I'm getting identical results on two similar LCD modules ordered from different places.
At the moment, I'm just setting the cursor position (to say column 0, row 0), then sending the character string for displaying on the LCD. But getting the corrupted characters unfortunately.
Clearing the LCD using lcd.clear() didn't help either.
Thanks for any help in advance!
#include <SPI.h>
#include <LiquidCrystal.h>
int Contrast=5;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
String mystring = "";
void setup()
{
Serial.begin(9600);
Serial.println("serial comms active");
pinMode(13,OUTPUT);
analogWrite(6,Contrast); // pin 6 of UNO producing PWM, connecting to the Vee contrast pin of the LCD, and 'Contrast' is a PWM level.
// set up the LCD's number of columns and rows:
delay(2000);
lcd.begin(16, 2);
delay(2000);
// Print a message to the LCD.
lcd.setCursor(0,1); //column 0, row 1
delay(2000);
mystring = String("Hello LCD!!");
lcd.print(mystring.c_str());
}
void loop()
{
}