On my Arduino Uno, when I'm not using the serial everything seems in order:
#include <LiquidCrystal.h>
LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
void setup()
{
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.clear();
lcd.print("Prints");
lcd.setCursor(0, 1);
lcd.print("Well");
}
void loop()
{
delay(1000);
}
However the moment I open the serial port with:
Serial.begin(9600);
The problem starts.
Clearing the LCD does not clear it but prints a character with 4 horizontal lines. Trying to move the cursor will print a different unrecognisable character. Sending things to the Arduino via the Serial port prints gibberish on the LCD.
Any idea why? Is there a way to work with the LCD and the serial port simultaneously? I require the serial port in order to control the Arduino from NodeJS.
#include <LiquidCrystal.h>
LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
void setup()
{
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.clear();
lcd.print("Prints");
lcd.setCursor(0, 1);
lcd.print("Well");
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for Native USB only
}
}
void loop()
{
lcd.clear(); // This will print 4 horizontal lines character instead of clearing
delay(500);
}