// Define pin numbers #define LED_PIN D7 #define BUTTON_PIN D6 // Setup function runs once when you press reset or power the board void setup() { // Initialize LED pin as an output pinMode(LED_PIN, OUTPUT); // Initialize button pin as an input pinMode(BUTTON_PIN, INPUT_PULLUP); } // Loop function runs repeatedly as long as the board has power void loop() { // Check if the button is pressed if (digitalRead(BUTTON_PIN) == LOW) { // Button is active low // Turn on the LED digitalWrite(LED_PIN, HIGH); } else { // Turn off the LED digitalWrite(LED_PIN, LOW); } }