#define LED_PIN 13
#define BUTTON_PIN 2
void setup() {
pinMode(LED_PIN, OUTPUT); // Set the LED pin as an output
pinMode(BUTTON_PIN, INPUT); // Set the button pin as an input
}
void loop() {
int buttonState = digitalRead(BUTTON_PIN); // Read the state of the button
if (buttonState == HIGH) {
digitalWrite(LED_PIN, HIGH); // Turn on the LED if the button is pressed
} else {
digitalWrite(LED_PIN, LOW); // Turn off the LED if the button is not pressed
}
}