Hi Forum Experts
I am testing a 16x2 LCD but the LCD only displays on the left half of the screen. Below is a sketch I am using to test. Am I missing something or is the hardware buggered ? Ive searched the forum but no similar issues that I can find unless I am just an idiot. Contrast works OK, No wierd characters, Right half simply just doesnt show any characters. I tired uploading an image but I keep getting an error.
// Sketch to scroll characters onto an LCD screen
#include <LiquidCrystal.h> //See note in text about what is needed here, i.e., LiquidCrystal.h enclosed inside
// greater thanand less than symbols
// This site often removes greater than and less than symbols and the text between them
// LiquidCrystal (rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
// Declare lcd as a LiquidCrystal Object
int i = 0;
int j = 0;
int k = 0;
int delayTime2 = 350; // Delay between shift
void scrollInFromRight (int line, char str1[])
{
// Written by R. Jordan Kreindler June 2016
i = strlen(str1);
for (j = 16; j >= 0; j--)
{
lcd.setCursor(0, line);
for (k = 0; k <= 15; k++)
{
lcd.print(" "); // Clear line
}
lcd.setCursor(j, line);
lcd.print(str1);
delay(delayTime2);
}
}
void scrollInFromLeft (int line, char str1[]) {
// Written by R. Jordan Kreindler June 2016
i = 40 - strlen(str1);
line = line - 1;
for (j = i; j <= i + 16; j++)
{
for (k = 0; k <= 15; k++)
{
lcd.print(" "); // Clear line
}
lcd.setCursor(j, line);
lcd.print(str1);
delay(delayTime2);
}
}
void setup()
{
Serial.begin(9600);
Serial.println("Starting test ...");
lcd.begin(16, 2);
lcd.clear();
lcd.print("Test Only");
}
void loop()
{
// lcd.clear();
// scrollInFromRight(0, "Line1 From Right");
// scrollInFromRight(1, "Line2 From Right");
// lcd.clear();
//scrollInFromLeft(0, "Line1 From Left.");
// scrollInFromLeft(1, "Line2 From Left.");
// lcd.clear();
// scrollInFromRight(0, "Line1 From Right");
// scrollInFromLeft(1, "Line2 From Left.");
// lcd.clear();
}