Engduino Lights Tutorial - Advanced
This tutorial will be a more advanced intro to using the Engduino.
Repeat all of the steps on the first page of "Engduino Lights Tutorial - Basics".
You should end up looking at a blank loop action like this:
Now create a for loop, from 0 to 17. Inside the for loop, set each LED (so LED "i") to white, followed
by a delay, then turn it off. You should end up with code looking like this:
This will create a cool pattern with the lights, where each light turns on and off, one after another.
Run the code on your Engduino to see!
Now use a while loop to do the same thing
backwards. Let's call your iterator (the number
that changes each time in the loop) "n".
You should start with n being 16, for the 16th
LED, and keep decreasing it each time for all
LEDs n > 0.
Now inside the loop, turn each nth LED on,
followed by a delay, then off again, like you did
above.
Don't forget to decrease n by 1! "n := n - 1"
makes sure each time you go round your while
loop, n decreases, until it hits 0.
When your code looks like the image above, try running it. You will now notice that you can do the
same thing with a for loop that you can with a while loop!
Well done! Now you've really got a grasp on how to use the Engduino, using some of the skills
you've previously learnt, such as for loops and while loops.