Push Button

Liam Brady

Push buttons are momentary switches; you press down on the button, and it completes the circuit. You release the button, and the circuit is once again open.

void setup() {
  Serial.begin(9600);
  pinMode(8, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(8) == false) {
    Serial.println(“Button is pressed.”);
  }
  delay(100);
}