1. Arduino GPIO Programming Basics

Sarah writes the given code. Analyze the circuit and determine what will be the output when the button is pressed.

void setup() {
  pinMode(7, INPUT_PULLUP);
  pinMode(8, OUTPUT);
}

void loop() {
  int buttonState = digitalRead(7);

  if (buttonState == HIGH) {
    digitalWrite(8, HIGH);
  } else {
    digitalWrite(8, LOW);
  }
}

Select Answer