Create a wait_for_start procedure
Modify P#2 into procedure (function) called a wait_for_start that you will use at the beginning of each future programming task.
- When the Arduino is reset, LED13 should blink on/off (two second period, 50% duty cycle) while waiting for the red pushbutton to be pressed. At the same time light blinks, print the alternating words "press" and "start" at 0.5 Hz rate.
- When the red button is pressed and held (debounce!!), LED13 should blink on/off (100 Hz, 50% duty cycle). In addition, print the alternating words "release" and "start" at a frequency of 0.5 Hz. In you program comments, make a note of what happens when you blink the LED at 0.5 Hz/50% duty cycle.
- When the red button is released (and debounced), turn the LED13 to green to indicate the program is running and print the word "Running..." only once.
Sample output:
Press
Press
Press
Press
Release
Release
Release
Running...
- A final note...whenever your program stops running (which all program should gracefully do under the correct conditions), please turn off LED13 and print "...end of program." Please write a simple main program to demonstrate this feature. Your main program should call the wait_for_start near the beginning, then do something simple, then gracefully end.