// Define the pin numbers
const int switch1 = 2; // the number of the switch pin
const int switch2 = 4;
const int led = 5; // the number of the LED pin
void setup() {
// Initialize the switch pin as an input with an internal pull-up resistor
pinMode(switch1, INPUT_PULLUP);
pinMode(switch2, INPUT_PULLUP);
// Initialize the LED pin as an output
pinMode(led, OUTPUT);
// Start with the LED off
digitalWrite(led, LOW);
}
void loop() {
// Read the state of the switch
int s1_State = digitalRead(switch1);
int s2_State = digitalRead(switch2);
// Check if the switch is pressed
// Since we are using INPUT_PULLUP, the switch will read LOW when pressed
if (s1_State == LOW && s2_State == HIGH) {
// Turn the LED on
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
} else if(s1_State == LOW && s2_State == LOW){
digitalWrite(led, HIGH);
delay(2000);
digitalWrite(led, LOW);
delay(1000);
}else{
digitalWrite(led, LOW);
}
// Small delay for debouncing the switch
delay(50);
}