String commandEntered = "";
void setup() {
Serial.begin(9600);
Serial.println();
}
void loop() {
if(Serial.available()>0)
{
commandEntered = Serial.readString();
Serial.println(commandEntered.length());
commandEntered.remove(commandEntered.length()-1);
Serial.println(commandEntered);
}
if(commandEntered == "on")
{
Serial.println(" on Sucess");
//commandEntered = "";
}
if(commandEntered == "off")
{
Serial.println("off Sucess");
//commandEntered = "";
}
}