int buttonPin = 2; // Pin for the button
int ledPin = 13; // Pin for the LED
int buttonState = 0; // Variable to store the button state
void setup() {
pinMode(ledPin, OUTPUT); // Set LED pin as output
pinMode(buttonPin, INPUT); // Set button pin as input
}
void loop() {
// Blink the LED
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(500);
// Read the button state
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
delay(3000);
}
}