Try the sample code with the circuit using an external LEDs rather than the
Try the sample code with two external LEDs rather than 1. Let’s say
you use the red LED and the green LED. Then modify the
if...elsestatement so that when the red LED is turned on, the green LED
is turned off, and when the green LED is turned on, the red LED is turned off.
Modify the delay time every 5th time the Arduino goes through
To do this,
- declare a global
counterand initialize it to 0
- declare another global
delayTimeand initialize it to (say) 200.
loop()to include another
at the top. This statement should test the value of
counter< 5, then the increment
counter>= 5, then reset
counterto 0, and increment