int ledPin = 3; // 3:Red, 5:Blue, 6:Green void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { if (Serial.available() > 0) { byte data = Serial.read(); if (data == 'H') { digitalWrite(ledPin, HIGH); Serial.println("LED: On"); } else { digitalWrite(ledPin, LOW); Serial.println("LED: Off"); } } }