// Define pin numbers const int buttonPin = 20; // D0 const int ledPin = 8; // D8 void setup() { // Initialize the button pin as an input pinMode(buttonPin, INPUT); // Initialize the LED pin as an output pinMode(ledPin, OUTPUT); // Turn off the LED initially digitalWrite(ledPin, LOW); } void loop() { // Read the state of the button int buttonState = digitalRead(buttonPin); // If the button is pressed, turn on the LED if (buttonState == HIGH) { digitalWrite(ledPin, HIGH); } else { // Otherwise, turn off the LED digitalWrite(ledPin, LOW); } }