Back

Bonus Project: Mini Cyclone

Difficulty  

Optional — Extra Credit

divider

What This Is

A light races along the row. Hit the button when it is on the target LED. Miss, and it speeds up to mock you.

The quickest bonus project here — it needs no new parts at all, just the five-LED array and one button you already had wired for Activity 2.8.

divider

What You'll Need

  • The five-LED array from Activity 2.6
  • One button, from 3V3 with Pin.PULL_DOWN
divider

Build It

  1. Race the light. Move a single lit LED along the row and wrap around to the start when it reaches the end.
  2. Pick a target at random and remember which position it is.
  3. Stop on the press and work out which LED was lit at that moment.
  4. Compare the two positions. Hit or miss?
  5. Speed up on a hit, slow down on a miss, so the game finds the player's limit on its own.

This is the project that needs positions rather than traversal. You cannot compare "where the light is" against "where the target is" without asking the list which LED, so leds[i] and the index i both matter here.

divider

What Success Looks Like

Target: LED 3
HIT!   speeding up
Target: LED 1
miss   slowing down
Target: LED 4
HIT!   speeding up
divider

Then Make It Yours

  • Flash the whole row on a hit
  • Beep differently for a hit and a miss
  • Play best-of-five and report a score
  • Mark the target by flashing it before the round starts

Commence Project