Question.2
Bob is a space cat who discovered the following circuit with the code. Which buttons does he need to press to turn on the LED?
int button1 = 7;
int button2 = 6;
int button3 = 5;
int ledPin = 3;
void setup() {
pinMode(button1, INPUT);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
}
void loop() {
int state1 = digitalRead(button1);
int state2 = digitalRead(button2);
int state3 = digitalRead(button3);
if (state1 == HIGH || state2 == HIGH || state3 == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}