Students will
- Explain how delay prevents other observations
- Use millis to schedule repeated behavior
- Keep an input responsive during an output sequence
Arduino Uno R3
Coordinate timed outputs while the sketch continues checking inputs, using elapsed time instead of long delays.
Reviewed connection map
Read before uploading
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
Choose the prompts that help students explain predictions, evidence, debugging, and transfer. Saving creates a new entry in this browser’s Rudi notebook.
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.
Update the saved timestamp only when the scheduled action occurs.
Keep millis-related variables unsigned long and compare elapsed time by subtraction.
2026 middle school standards
These are evidence-based crosswalk candidates for curriculum review—not a claim of official alignment.
Students use a named procedure to separate repeated output behavior from timing logic.
Lesson evidence: Annotated reusable procedureStudents trace variables, selection, or iteration in the supplied sketch and connect code to physical behavior.
Lesson evidence: millis, comparison, and loop tracesketch-foundations
Starting point, not verified curriculum. Review the actual hardware, circuit, code, power requirements, and classroom conditions.
After teaching this lesson