In the last lesson, you learned how to turn on LED on and off using digitalwrite, with a bit of set up from pinmode. In this lesson
we will use a for-loop to flash an LED on and off. To control the flash rate, use the delay function.
Move the mouse over a dotted box for more information.
Now you try. Go for it! Try to flash an LED on and off 10 times!
Type your code here:
See your results here:
This code will not run! First, think of how many times you want to flash the LED. Fix the for-loop condition to handle this. Next
how can you make the LED turn on in the first digitalwrite statement...then off again in the second one?
Here is what your Arduino assembly might look like for this lesson:
Note if you don't have an LED, pay attention to the yellow square labeled "L" on your Arduino (also shown in this image).
Share your code
Show a friend, family member, or teacher what you've done!