#define LED_PIN 0 // LED connected to GP0
#define BUTTON_PIN 2 // Button connected to GP2
void setup() {
pinMode(LED_PIN, OUTPUT); // Set LED pin as output
pinMode(BUTTON_PIN, INPUT_PULLDOWN); // Set button pin as input with pull-down resistor
}
void loop() {
if (digitalRead(BUTTON_PIN) == HIGH) {
digitalWrite(LED_PIN, HIGH); // Turn on LED
} else {
digitalWrite(LED_PIN, LOW); // Turn off LED
}
delay(100);
}