Question.3
Kevin has built the following circuit. When will the LED turn ON?
void setup() {
pinMode(4, OUTPUT);
pinMode(2, INPUT_PULLUP);
}
void loop() {
int buttonState = digitalRead(2);
if (buttonState == HIGH) {
digitalWrite(4, HIGH);
} else {
digitalWrite(4, LOW);
}
}