void setup() {
pinMode(2, INPUT);
pinMode(13, OUTPUT);
}
void loop() {
// Read the state of the switch
int switchState = digitalRead(2);
if (switchState == HIGH) {
// Switch is ON, blink the LED
digitalWrite(13, HIGH);
delay(5000);
digitalWrite(13, LOW);
delay(5000);
} else {
// Switch is OFF, keep the LED off
digitalWrite(13, LOW);
}
}