#define LED_PIN 0 // LED connected to pin 1 #define BUTTON_PIN 1 // Pushbutton connected to pin 2 void setup() { pinMode(LED_PIN, OUTPUT); // Set LED pin as output pinMode(BUTTON_PIN, INPUT_PULLUP); // Set button pin as input with pull-up resistor } void loop() { int buttonState = digitalRead(BUTTON_PIN); // Read button state if (buttonState == LOW) { // If button is pressed digitalWrite(LED_PIN, HIGH); // Turn on LED } else { digitalWrite(LED_PIN, LOW); // Turn off LED } }