// Declare the pins for the Button and the LED<br>
int buttonPinR = 12;
int buttonPinL = 13;
int transistorR = 2;
int transistorL = 3;
void setup() {
// Define pin #12 as input and activate the internal pull-up resistor
pinMode(buttonPinL, INPUT_PULLUP);
pinMode(buttonPinR, INPUT_PULLUP);
// Define pin #13 as output, for the LED
pinMode(transistorR, OUTPUT);
pinMode(transistorL, OUTPUT);
}
void loop(){
// Read the value of the input. It can either be 1 or 0
int buttonValueL = digitalRead(buttonPinL);
if (buttonValueL == LOW){
// If button pushed, turn LED on
digitalWrite(transistorL,HIGH);
delay(500);
digitalWrite(transistorL,LOW);
delay(500);
} else {
// Otherwise, turn the LED off
digitalWrite(transistorL, LOW);
}
// Read the value of the input. It can either be 1 or 0
int buttonValueR = digitalRead(buttonPinR);
if (buttonValueR == LOW){
// If button pushed, turn LED on
digitalWrite(transistorR,HIGH);
delay(500);
digitalWrite(transistorR,LOW);
delay(500);
} else {
// Otherwise, turn the LED off
digitalWrite(transistorR, LOW);
}
}