const int switch1Pin = 13; // Connect switch 1 to digital pin 2
const int switch2Pin = 12; // Connect switch 2 to digital pin 3
const int led1Pin = 19; // Connect LED 1 to digital pin 4
const int led2Pin = 4; // Connect LED 2 to digital pin 5
void setup() {
pinMode(switch1Pin, INPUT);
pinMode(switch2Pin, INPUT);
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
}
void loop() {
// Read the state of each switch
int switch1State = digitalRead(switch1Pin);
int switch2State = digitalRead(switch2Pin);
// Control LED 1
if (switch1State == HIGH) {
digitalWrite(led1Pin, HIGH); // Turn on LED 1
} else {
digitalWrite(led1Pin, LOW); // Turn off LED 1
}
// Control LED 2
if (switch2State == HIGH) {
digitalWrite(led2Pin, HIGH); // Turn on LED 2
} else {
digitalWrite(led2Pin, LOW); // Turn off LED 2
}
}