/*control the led using serial monitor and print the input string
on LCD*/
#include<LiquidCrystal.h>
LiquidCrystal lcd(17,2,16,4,0,15);
void setup(){
lcd.begin(16,2);
pinMode(23,OUTPUT);
Serial.begin(9600);
Serial.println("ENTER YOUR INPUT PLEASE: ");
}
void loop(){
if(Serial.available()>0){
String x=Serial.readStringUntil('\n');
lcd.setCursor(0,0);
if(x=="ON"){
digitalWrite(23, HIGH);
lcd.print("LED IS ON!");
}
else if(x=="OFF"){
digitalWrite(23, LOW);
lcd.print("LED IS OFF!");
}
else{
digitalWrite(23, LOW);
lcd.print("WRONG INPUT");
Serial.println("PLEASE ENTER ON OR OFF");
}
}
}