button = pressedread a two-state input
Public lesson / Robotics
A machine reports 347. Is that bright, close, tilted, pressed, or meaningless? A sensor reading becomes useful only when we know what was measured and how the program interprets it.
Lesson rhythm
Name the problem before opening the build.
Make the hidden rule visible with small tests.
Use the idea inside a working project system.
Change one rule and predict the effect.
Explain the result, save safely, and leave a known state.
Learning goals
Theory kernel
button = pressedread a two-state input
distance < 15compare a measurement with a threshold
light levelinspect a changing value
read repeatedlysample over time
Guided-build preview
Wait for an unpredictable signal, press as quickly as possible, and make the timer distrust suspiciously early presses.
A waiting state, Random start delay, Visible go signal, Button response.
Input, Timing, Variables, Randomness, State.
A working version, one modification, one repaired problem, and an explanation.
Teacher checkpoints
Common mistakes
Modification challenge
Higher levels are optional. They deepen the current idea rather than turning a beginner lesson into an unrelated advanced task.
End-of-class demonstration