int Relay = 2; void setup() { pinMode(Relay, OUTPUT); Serial.begin(115200); } void loop() { Serial.println("Plase input H or L:"); char cmd; while(Serial.available() > 0){ cmd = Serial.read(); if (cmd == 'H') { Serial.println("Relay is HIGH"); digitalWrite(Relay,HIGH); } else if(cmd == 'L'){ Serial.println("Relay is LOW"); digitalWrite(Relay,LOW); } } delay(5000); }