External LED Experiments
After completing the External LED project, test yourself by trying these experiments.
On the Arduino board, you can use any of the digital pins from 2 to 13.
1 | Connect the external LED to pin 5 instead of pin 3. Modify the code so that it will control the LED on pin 5 to turn on for 1 second and off for 1 second.
Notice that there are three places in the code where the number 3 has to be changed to the number 5. | |
2 | Instead of putting the number 5 in these three places, you can create a variable name called led and assign the value 5 to it.
The Now you just use the variable led instead of the number 5 in the | |
3 | Assign the number 13 to the led variable. What happens when you run the program? | |