Exercise 1—Bike Lite
Given the schematic:

Create a safety bike light that turns on (blinks the lights on and off) when the button is clicked and turns off the next time the button is clicked.
If you notice some strange behavior when you press the button,
- Add a delay of 10 milliseconds after you read the state of the button in the loop.
- Read the state of the button and store it in anoter variable
- Test if the first state equals the second state
- If the condition is met, continue with program
Exercise 2—Better Bike Lite
The bike lite should have a few modes.
If you used a boolean to test if the light was on or off, replace that variable with lightMode and set the type to
int
When you press the button, the lightMode should increment, but if it has gone beyond the number of modes, reset the lightMode to 0.
In your loop test if the lightMode is not 0. To create different modes, change the interval values for each mode.