Lab 2 has two parts: a Technical Study on RC debouncer design (prelab math), and two Design Challenges implemented on the Nucleo. Read the full lab handout for the prelab deliverables.
Figure2.8.1.Lab 2 breadboard setup: three LEDs (two red WIN LEDs and one green starter LED), two pushbutton switches, and debounce capacitors. Each LED has its own 220 ฮฉ current-limiting resistor.
Starting from blinkyCNT.c, implement a button-controlled pause/resume: pressing the button once pauses the LED counter; pressing again resumes it. Use your debounce capacitor (0.1 ยตF or 0.15 ยตF) across the switch. Use the FSM pattern to avoid blocking.
Each player presses their button as soon as they see the steady light. The first player to press wins; their WIN LED lights (or blinks rapidly) for one second.
Design with a state machine. Start with a paper state diagram before writing any code; include it in your submission along with pseudocode and a debugging diary.
Optional extensions (no extra points): (a) A false start, pressing before the steady light, awards the win to the other player. (b) Make the delay between the last flash and the steady ON slightly random (run a fast counter in the background and sample it when a player starts the game) to prevent timing the flashes.