Week 3 ยท Functions, Outputs & Buttons

Session 15: Review: reaction timer

Review & mini-projectFlex120 minNo new lesson

Learning outcomes

  • Combine outputs, a button and timing in a small game
  • Measure a time interval with millis() and random()
  • Test a program against success criteria written first

Kit and components

  • RGB LED and buzzer circuit, push button, Uno

Pre-reading about 15 min

Students read these on their phones before class. They are listed on the student Before class page.

  1. Theory Reference: millis()
  2. Theory Reference: min(), max(), random()

Session plan

  1. 0:0015 min
    Quiz

    Week 3 quiz

  2. 0:1550 min
    Build

    Mini-project: reaction timer

    After a random wait of 2-5 s the RGB LED turns green and the buzzer beeps. The player presses the button and Serial prints the reaction time in milliseconds. Students write three success criteria before coding and test against them.

  3. 1:0540 min
  4. 1:4515 min
    Discuss

    Did it meet the criteria?

Checkpoint: ready to move on?

Every student has completed the core exercises of Code Along chapters 5-7 or has an agreed catch-up plan.

Extension for fast finishers

Keep a best time and print a new record when it is beaten.

Catch-up path

Homework and practice

Pre-reading for S16.

Facilitator notes

  • Flex session: in a shorter course keep the quiz and Code Along catch-up and fold them into the S16 recap.