Week 2 ยท Decisions & Debugging
Session 10: Review: LED patterns under Serial control
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.
Session plan
- 0:0015 minQuiz
Week 2 quiz
- 0:1545 minBuild
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.
- 1:0045 minCode 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.
- 1:4515 minDiscuss
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.