/// Configure the LED using serial Monitor and display output in LCD
/// 12221263
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 14, 16, 17, 18, 19);
void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
pinMode(13, OUTPUT);
Serial.begin(9600);
Serial.println("Enter your input: ");
lcd.setCursor(0, 0);
lcd.print("Enter your input: ");
lcd.autoscroll();
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() > 0) {
String cmd = Serial.readStringUntil('\n');
lcd.setCursor(0, 0);
if (cmd == "ON") {
lcd.clear();
lcd.print("LED ON!!!");
digitalWrite(13, HIGH);
} else if (cmd == "OFF") {
lcd.clear();
lcd.print("LED OFF!!!");
digitalWrite(13, LOW);
} else {
lcd.clear();
lcd.print("Invalid Input. It should only be ON or OFF");
lcd.autoscroll();
}
Serial.println(cmd);
}
}