Guided physical computing, beginning with the Arduino Starter Kit Classroom Pack

Arduino Uno R3

Read a pushbutton reliably

Read a momentary pushbutton with a defined resting state and make its active-low behavior visible in Serial Monitor.

CSTA 2026 mapping candidatesNot reviewed by CSTA
MS-PRO-RD-17ProgrammingMS-PRO-TR-19Programming

Students will

  • Prevent a floating digital input with INPUT_PULLUP
  • Identify the internally connected button legs
  • Explain why released is HIGH and pressed is LOW

Evidence of success

  • Released readings remain HIGH
  • Pressed readings remain LOW
  • The student explains how the internal pull-up defines the resting state

Hardware

  • Arduino Uno R3
  • Momentary pushbutton
  • Breadboard and jumper wires

Prerequisites

  • Upload a sketch
  • Open Serial Monitor
  • Identify digital pins and GND

Before class

  • Verify the button's internally connected leg pairs
  • Prepare a known-good D8-to-GND circuit
  • Open Serial Monitor at 9600 baud

Reviewed connection map

Stable pushbutton input

Arduino D8Configured as INPUT_PULLUP
PushbuttonVerify the internally paired legs
GNDPressed connects D8 to ground
  1. Place the pushbutton so the two sides occupy separate breadboard nodes.
  2. Connect D8 to one side of the button and GND to the opposite side.
  3. Released reads HIGH; pressed reads LOW because the sketch uses INPUT_PULLUP.

Build and test

  1. 01Inspect or test which button legs are internally connected
  2. 02Place the button across the breadboard gap
  3. 03Connect one side to D8 and the opposite side to GND
  4. 04Upload the INPUT_PULLUP sketch
  5. 05Compare repeated released and pressed readings

Read before uploading

Annotated Arduino sketch

const int BUTTON_PIN = 8;

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

void loop() {
  bool pressed = digitalRead(BUTTON_PIN) == LOW;
  Serial.println(pressed ? "pressed" : "released");
  delay(50);
}

Optional engineering record

Record evidence from this lesson

Choose the prompts that help students explain predictions, evidence, debugging, and transfer. Saving creates a new entry in this browser’s Rudi notebook.

Record your thinking — optional4 prompts

Use these prompts if they help students capture evidence, decisions, or questions. You do not need to complete every prompt or create an entry at every step.

Nothing is saved until you choose this button.

Troubleshooting

The reading never changes

Rotate or reposition the button so D8 and GND are not connected to the same internal leg pair.

The reading changes without a press

Confirm pinMode uses INPUT_PULLUP and that the sketch reads the same pin used by the circuit.

2026 middle school standards

Potential CSTA connections

Not reviewed by CSTA

These are evidence-based crosswalk candidates for curriculum review—not a claim of official alignment.

MS-PRO-RD-17

Analyze the roles of iteration, selection, variables, and procedures in a segment of code.

Students trace variables, selection, or iteration in the supplied sketch and connect code to physical behavior.

Lesson evidence: Explanation of active-low selection
MS-PRO-TR-19

Use systematic strategies to test, refine, and document changes to a computing technology to meet the intended purpose.

Students isolate variables, compare observed behavior with the intended purpose, and document a revision.

Lesson evidence: Repeated released and pressed readings
View the official 2026 CSTA standardsStandard text: Computer Science Teachers Association (2026), CC BY-NC-SA 4.0.

Supporting concepts

floating-inputs · sketch-foundations

Sources and review

Arduino Uno R3 documentationArduino Projects Book · CC BY-NC-SA 3.0

Starting point, not verified curriculum. Review the actual hardware, circuit, code, power requirements, and classroom conditions.

After teaching this lesson

Make one bounded change—or connect the skill to a project.