Dead Man's Switch
STM32 Watchdog Feed Exercise
Task
On a train, the driver must keep holding a handle called a dead man's switch, or the train brakes by itself. This board has a watchdog for the same job. A watchdog is a timer inside the chip that restarts the board if the program stops checking in for 1 second. Checking in is called feeding the watchdog.
A sample is one reading from the sensor. Log every sample as one line on the terminal, SAMPLE n with n counting from 1, for as long as the board runs: SAMPLE 1, SAMPLE 2, SAMPLE 3 and on, one per line Write main from the given functions.
Circuit
Pass condition
SAMPLE 1, SAMPLE 2 and on, one line per pulse on PA0, in order. The watchdog is started and fed after each sample, and never fed once the samples stop.
Notes
For each sample the sensor pulses PA0 high for 2 ms, about every 10 ms while your program runs, and may stop at any time.