// Define the pin numbers for the button and LED const int buttonPin = D1; // Where the button is connected const int ledPin = D0; // Where the LED is connected void setup() { // Set the button pin as INPUT pinMode(buttonPin, INPUT); // Set the LED pin as OUTPUT pinMode(ledPin, OUTPUT); } void loop() { // Read the state of the button int buttonState = digitalRead(buttonPin); // Check if the button is pressed if (buttonState == HIGH) { // If the button is pressed, turn on the LED digitalWrite(ledPin, HIGH); } else { // If the button is not pressed, turn off the LED digitalWrite(ledPin, LOW); } }