Week 2 ยท Decisions & Debugging

Session 10: Review: LED patterns under Serial control

Review & mini-project120 minNo new lesson

Learning outcomes

  • Combine arrays, loops, decisions and Serial commands in one sketch
  • Plan a command table before writing code
  • Explain a design decision to the class

Kit and components

  • Four-LED circuit from S9, Uno and lab PC

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: while and do/while
  2. Theory Reference: Arrays

Session plan

  1. 0:0015 min
    Quiz

    Week 2 quiz

  2. 0:1545 min
    Build

    Mini-project: pattern controller

    Serial commands choose a pattern stored in arrays: c chase, r reverse, a all flash, + and - change the speed. Students write the command table first, then code it.

  3. 1:0045 min
    Code Along

    Loops practice and catch-up

    Everyone does PWM duty table and Average of five readings, moved here from S9. Then finish Where was the peak? and Newest reading first, or any earlier core exercise still open.

  4. 1:4515 min
    Discuss

    Show and explain

    Three students demonstrate their controller and explain one design decision each.

Checkpoint: ready to move on?

Every student has finished the core exercises of Code Along chapters 3 and 4.

Extension for fast finishers

Catch-up path

Finish the core exercises with a partner; build the pattern controller without the speed commands.

Homework and practice

Pre-reading for S11.

Facilitator notes

  • The mini-project uses nothing new. Students who struggle usually need to plan the command table before typing.