Activity 1.2.5. Design and Build blinkySlowToFast in the Simulator.
Your job is to make the LED start slow, speed up blink by blink, then reset to slow and repeat. Design the logic first, then build it in the simulator. You already know that the delay-loop bound controls the blink rate, so the ramp is really a question of how that bound changes over time.
(a)
Design first. What variable will control the delay, and how does it change from one blink to the next? How will the program know it has reached “fast” and should reset to “slow”? Start by writing the logic of
main() in plain English or pseudocode before you write any C.
(b)
Warm up. Open the simulator, which comes loaded with the same
blinky.c you ran in class. Confirm the simulated LED blinks and that you can read the register panel as your code runs.
(c)
Build it. Implement your
blinkySlowToFast design in the simulator until the LED ramps slow → fast → reset → repeat. Use descriptive constant names for the starting delay, the ending delay, and the step size.
(d)
The simulator does not save your code. If you reload or close the tab your work is gone, so use the download button (the downward arrow) to keep a copy on your own computer before you move on. Tomorrow you will port it to the real Nucleo. Note one thing you are unsure will behave the same on real hardware.
