const int buttonPin = 2; // the pin that the pushbutton is attached to const int buttonPin2 = 3; // the pin that the pushbutton is attached to const int ledPin1 = 4; // the pin that the first LED is attached to const int ledPin2 = 5; // the pin that the second LED is attached to int buttonState = 0; // variable for reading the pushbutton status int buttonState2 = 0; void setup() { pinMode(ledPin1, OUTPUT); // initialize the LED pin as an output pinMode(ledPin2, OUTPUT); // initialize the LED pin as an output pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input pinMode(buttonPin2, INPUT); // initialize the pushbutton pin as an input } void loop() { // read the state of the pushbutton value buttonState = digitalRead(buttonPin); buttonState2 = digitalRead(buttonPin2); // check if the pushbutton is pressed if (buttonState == HIGH) { // turn on the LED connected to pin digitalWrite(ledPin1, HIGH); // turn off the LED connected to pin digitalWrite(ledPin2, LOW); } else if(buttonState2 == HIGH){ digitalWrite(ledPin2, LOW); }else { // turn off the LED connected to pin 4 digitalWrite(ledPin1, LOW); // turn on the LED connected to pin 5 digitalWrite(ledPin2, HIGH); } }