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

Arduino Uno R3

Sequence without blocking

Coordinate timed outputs while the sketch continues checking inputs, using elapsed time instead of long delays.

CSTA 2026 mapping candidatesNot reviewed by CSTA
MS-PRO-PD-12ProgrammingMS-PRO-RD-17Programming

Students will

  • Explain how delay prevents other observations
  • Use millis to schedule repeated behavior
  • Keep an input responsive during an output sequence

Evidence of success

  • The LED follows its interval without delay
  • Button presses are observed while the timed behavior continues
  • The student can identify the stored timestamp, interval, and elapsed-time comparison

Hardware

  • Arduino Uno R3
  • Built-in LED or protected external LED
  • Momentary pushbutton
  • Breadboard and jumper wires if using external parts

Prerequisites

  • Read a reliable digital input
  • Control a digital output
  • Use variables and conditions

Before class

  • Prepare a delay-based comparison sketch
  • Use unsigned long for elapsed-time values
  • Choose intervals that learners can observe

Reviewed connection map

Timed output with responsive input

Button D8-GNDStable active-low input
Arduino loopChecks elapsed time and input every pass
LED_BUILTINTimed visible output
Serial MonitorImmediate button evidence over USB
  1. Connect the button between D8 and GND.
  2. The timed output uses the built-in LED, so no external output circuit is required.

Build and test

  1. 01Run a blinking sketch that uses delay and try to read a button during the wait
  2. 02Record why responsiveness is limited
  3. 03Store the last-change time and compare it with millis
  4. 04Toggle the LED only when the interval has elapsed
  5. 05Add button reporting and verify it remains responsive between LED changes

Read before uploading

Annotated Arduino sketch

const int BUTTON_PIN = 8;
const unsigned long INTERVAL = 500;
unsigned long lastChange = 0;
bool ledState = LOW;

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

void loop() {
  unsigned long now = millis();
  if (now - lastChange >= INTERVAL) {
    lastChange = now;
    ledState = !ledState;
    digitalWrite(LED_BUILTIN, ledState);
  }
  if (digitalRead(BUTTON_PIN) == LOW) Serial.println("pressed");
}

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 output changes continuously

Update the saved timestamp only when the scheduled action occurs.

Timing fails after code changes

Keep millis-related variables unsigned long and compare elapsed time by subtraction.

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-PD-12

Use a procedure to structure code for clarity and reusability.

Students use a named procedure to separate repeated output behavior from timing logic.

Lesson evidence: Annotated reusable procedure
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: millis, comparison, and loop trace
View the official 2026 CSTA standardsStandard text: Computer Science Teachers Association (2026), CC BY-NC-SA 4.0.

Supporting concepts

sketch-foundations

Sources and review

Arduino Uno R3 documentationArduino Projects Book · CC BY-NC-SA 3.0Arduino Blink Without Delay example

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.