// Define the pin numbers #define BUTTON_PIN 1 // Pin D1 #define LED_PIN 0 // Pin D0 void setup() { // Initialize the LED pin as an output pinMode(LED_PIN, OUTPUT); // Initialize the button pin as an input with internal pull-up resistor enabled pinMode(BUTTON_PIN, INPUT_PULLUP); } void loop() { // Read the state of the button int buttonState = digitalRead(BUTTON_PIN); // If the button is pressed (buttonState is LOW) if (buttonState == LOW) { // Turn on the LED digitalWrite(LED_PIN, HIGH); } else { // Turn off the LED digitalWrite(LED_PIN, LOW); } }