Week 3 · Lesson 1 · 55 minutes
Build and explain the first code version
I can follow my plan to build a first version.
Planned lesson. Follow your teacher’s teaching order.
Task steps and checks
Build the first timer when ready
- Start only after your teacher confirms button availability and readiness. Choose a saved plan step. Get the actual LED, resistor and button wiring checked with USB unplugged.
- Save your own ReactionTimer.ino copy. Match LED_PIN and BUTTON_PIN to the checked circuit; read WAIT_MIN_MS and WAIT_MAX_MS. Upload with the approved board settings and use 115200.
- Wait
- GO light appears
- Press after GO
- Show elapsed time
Check your result: Point to the plan step and line of code for one part. The wait settings control the delay before GO, not the result the player should get.
Revised weekly handout pages: 7.
Materials
ReactionTimer.ino, approved IDE/profile, USB data cable. · Individual student workbook and evidence folder; paired hardware, individual answers
Resources
Vocabulary
- version
- a saved copy at one stage
See it
Watch
Watch why a button pin needs a pull-up, and why a pressed button reads LOW. The video uses an Arduino Uno; your ESP32 works the same way.
Arduino Basics - INPUT and INPUT_PULLUP Using a ButtonYouTube
The video is on YouTube, which needs a VPN on most networks in mainland China. It is extra: the lesson works without it.
More examples and practice
Students identify today’s step in their plan · 5 minutes
Use the Week 2 plan to choose today’s step. A version is a saved copy at a particular stage. Save your own ReactionTimer.ino copy before editing so you can show what changed.
Students identify today’s step in their plan.
Explain pins, wait range and the state sequence · 8 minutes
LED_PIN identifies the output GPIO; BUTTON_PIN identifies the input GPIO. WAIT_MIN_MS and WAIT_MAX_MS define the random wait range in milliseconds. In the supplied code they are 2000 and 5000: two to five seconds. These waits make the GO moment less predictable; they are not the measured reaction time.
Locate the four constants in the starter and explain each in a short sentence. Trace the release, random wait and press states together. Work the practice example before revealing its solution.
WAIT_MIN_MS is 2000 and WAIT_MAX_MS is 5000. A learner says every reaction result must be 2000–5000 ms. Is that correct?
Reveal reasoning
No. Those constants control the wait before GO. The reaction measurement starts when the LED turns on and ends at the first detected valid press. The wait and the reaction are different intervals.
Pairs check wiring, save individual copies and upload · 22 minutes
Check the unpowered circuit, then use only the teacher-approved board and port profile. Upload the saved sketch and open Serial Monitor at 115200. Do not borrow a different ESP32 board pinout because its name looks similar.
Follow your plan, save and upload your own copy, complete the four code-name meanings on page 7, and record the actual completed step and evidence filename.
Practice
- Locate the four constants in the starter and explain each in a short sentence. Trace the release, random wait and press states together.
- Follow your plan, save and upload your own copy, complete the four code-name meanings on page 7, and record the actual completed step and evidence filename.
Students explain named constants and the current state · 15 minutes
The code waits for stable button release, waits a random time, then waits for a press after GO. The button uses INPUT_PULLUP, so LOW means pressed. Point to each constant and explain its job before making changes.
Students explain named constants and the current state.
Save first-version evidence · 5 minutes
Record which plan step you completed and name the code/photo evidence. A successful upload is not proof of all timer behaviour; next lesson checks normal and early presses.
Which constant names a physical input, and what is the input when the button is pressed? Save the page and relevant evidence.
Which constant names a physical input, and what is the input when the button is pressed?
Week 3 Make the first timer
Do only the parts you did not finish in class. Write what really happened; if you did not test something, write NOT TESTED. This is one task for the week, and nothing else is due.
- Page 7: write the meaning of the four code names. Record the step you really completed and the evidence filename.
- Page 8: record the three checks. For each one write your prediction, the real result and your next step.
- If you changed the code, save it as a new version.
You are finished when: Pages 7 and 8 are complete and your own copy of the code is saved.
Why this matters: A first working timer is what you diagnose, improve and test in the coming weeks.
- Hardware stays at school.
Revised weekly handout pages: 7, 8.
Make and check the first timer weekly feedback guide
Task-specific feedback guide, not official IB descriptors or an automatic criterion grade.
- Plan and code understanding
- The student links work to the plan and explains the four named constants.
- First version
- Own code copy, checked upload and first-version evidence are retained.
- Initial checks
- Two normal rounds and one early press have actual records; a fault leads to a safe single-cause test.
| Band | Observable evidence |
|---|---|
| 0 | No first-version record or explanation is available yet; performance cannot be inferred. |
| 1–2 | A build attempt is shown, but the plan link, code meanings or test records are mostly missing or unclear. |
| 3–4 | A saved version and some code meanings are shown. Some normal or early-press results are recorded, but the checks or next action need more detail. |
| 5–6 | The student explains the constants, follows a named plan step, saves a version and records all three initial checks honestly. A next step follows the observations. |
| 7–8 | The evidence clearly links plan, code and actual behaviour. Versions and complete initial checks are traceable; safe diagnosis tests one cause and the next action is explained using the result, even if a fault remains. |