Question.8
Henry has built the following circuit. Which statement is true about it?
const int button1Pin = 4;
const int button2Pin = 5;
const int ledPin = 2;
void setup() {
pinMode(button1Pin, INPUT_PULLUP);
pinMode(button2Pin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
bool button1State = digitalRead(button1Pin);
bool button2State = !digitalRead(button2Pin);
if (button1State && button2State) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}