Ok, so I am trying to get an LCD working with some basic code. In the setup you can see that on line 1 I print "Arduino" and in line 2 I print "Fun".
This works 100% as expected, both lines appear on the LCD, where they should.
The problem is on the loop. If I use the "#" it clears the display, if I use the "/" it does nothing at all!
So if I type "#Hello/World" I would expect it to clear the screen, print "Hello" on line 1 and "World" on line 2, but all I get is "Hello/World", it totally ignores the "/"
Why does it do this??
I also have an issue where I am getting 3 vertical lines at the end due to CR & LF I believe, but before I look at that I want to get it working as expected.
Here is the code, all suggestions welcome....
#include <LiquidCrystal.h>
//LCD (RS, E, D4, D5, D6, D7)
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
int numRows = 2;
int numCols = 16;
void setup(){
Serial.begin(9600);
lcd.begin(numCols, numRows);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Arduino");
lcd.setCursor(0, 1);
lcd.print("Fun");
}
void loop() {
if (Serial.available()>0){
char ch = Serial.read();
if (ch == '#')
{
lcd.clear();
}
else if (ch == "/")
{
lcd.setCursor(0, 1);
}
else{
lcd.write(ch);
}
}
}