#define LED_PIN D0 // Change according to your connection
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600); // Initialize serial communication
}
void loop() {
if (Serial.available() > 0) {
char received = Serial.read();
if (received == '1') {
digitalWrite(LED_PIN, HIGH); // Turn LED on
} else if (received == '0') {
digitalWrite(LED_PIN, LOW); // Turn LED off
}
}
}