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

Arduino Uno R3

Button to signal

Build a stable digital input, control a protected LED, and explain how a physical action becomes program behavior.

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

Students will

  • Read a button with a defined resting state
  • Control a current-limited LED
  • Trace input, decision, and output in a sketch

Evidence of success

  • LED responds consistently to at least five presses
  • Serial output agrees with the physical button state
  • Student identifies the input, decision, and output lines

Hardware

  • Arduino Uno R3
  • Momentary pushbutton
  • LED
  • 220 Ω resistor
  • Breadboard and jumper wires

Prerequisites

  • Identify 5V, GND, and digital pins
  • Upload a sketch

Before class

  • Verify the button's internally connected leg pairs
  • Confirm LED polarity and resistor value
  • Open Serial Monitor at 9600 baud

Reviewed connection map

Input, decision, and protected output

Button + GNDPhysical input closes to ground
D8 INPUT_PULLUPStable released HIGH / pressed LOW signal
Program decisionbuttonState == LOW means pressed
D9 outputControls the response
220 Ω + LED + GNDProtected visible output and return path
  1. Connect the button between D8 and GND; verify which legs are internally paired.
  2. Connect D9 through one 220 Ω resistor to the LED anode, then connect the LED cathode to GND.
  3. Test the button input and protected LED output separately before running the combined sketch.

Build and test

  1. 01Test the LED output independently
  2. 02Wire the button from D8 to GND and configure INPUT_PULLUP
  3. 03Observe released HIGH and pressed LOW
  4. 04Combine the input with the LED output
  5. 05Repeat the test and record evidence

Read before uploading

Annotated Arduino sketch

const int BUTTON_PIN = 8;
const int LED_PIN = 9;

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

void loop() {
  const int buttonState = digitalRead(BUTTON_PIN);
  const bool isPressed = buttonState == LOW;

  digitalWrite(LED_PIN, isPressed ? HIGH : LOW);
  Serial.println(isPressed ? "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

Input changes without a press

Confirm INPUT_PULLUP and the button-to-GND connection.

LED never lights

Test polarity, resistor placement, GND, and the D9 wire independently.

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: Input–decision–output code trace
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: Five-trial response record
View the official 2026 CSTA standardsStandard text: Computer Science Teachers Association (2026), CC BY-NC-SA 4.0.

Supporting concepts

floating-inputs · ohms-law · power-and-signals

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.