Changes

Jump to: navigation, search

Classes/2010/VIS147A/Lab7

583 bytes added, 16:21, 23 February 2010
Part 4 - Looping over Multiple Digital Outputs
=== Part 4 - Looping over Multiple Digital Outputs ===
==== Writing a loop ====* Set up three six or more digital LED outputs simliar similar to those in part 1. (work in pairs if you would like)
[[Image:Three_lights.jpg|400px]]
* Open File->Sketchbook->Examples->Control->ForLoopIteration* Same as . This program is similar to the single input above, however with multiple LED outputsat once. It uses a <code>loop</code> statement to run across a series of pins rather than having to write each output as a separate line.
* Compile, upload, and run the loop example.
* Try changing the value of the <code>int timer = 100;</code> variable. As the comment in the program says, <code>// The higher the number, the slower the timing.</code>. Conversely, the smaller the value the faster the timing.* Experiment with shorter and shorter timing--until the point at some point which you should are no longer be able to see the discern individual LEDs turn turning on and off. Remember my multiplexed display example in class, I was technically turning each column on one-at-a-time, but past a point it looked as if the whole smiley-face image was on non-stop. This has to do with the idea of [http://en.wikipedia.org/wiki/Persistence_of_vision persistence of vision]. At what value for <code>timer</code> does it appear that all LEDs are on continually ____.* Change the behavior More examples of displays utilizing POV: ** http://www.ladyada.net/make/minipov3/index.html** bike wheel poke POV http://www.instructables.com/id/SpokePOV%3a-LED-Bike-Wheel-Images/** http://www.youtube.com/watch?v=mT13ZcpwYtA==== Changing the loop: how ====* How about instead of equal on/off timing, change it in some other way.
* Can you make the loop run through a series of meaningful states, rather repeating a simple on/off behavior.
* Alternately, with only one output, how could you make a program that changes over time using a loop.

Navigation menu