int buttonPin = D1; // Button connected to GPIO 2
int ledPin = D10; // LED connected to GPIO 10
void setup() {
pinMode(buttonPin, INPUT); // Button as input (pull-down handled externally)
pinMode(ledPin, OUTPUT); // LED as output
}
void loop() {
int buttonState = digitalRead(buttonPin); // Read button state
if (buttonState == HIGH) { // Button pressed
digitalWrite(ledPin, HIGH); // Turn LED on
} else {
digitalWrite(ledPin, LOW); // Turn LED off
}
delay(10); // Small debounce delay
}
esp:D0
esp:D1
esp:D2
esp:D3
esp:D4
esp:D5
esp:D6
esp:D7
esp:D8
esp:D9
esp:D10
esp:3V3
esp:GND
esp:5V
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r1:1
r1:2
led1:A
led1:C
r2:1
r2:2