Changes

Classes/2010/VIS147A/Lab7

603 bytes added, 16:16, 23 February 2010
Activities
* As you desire more complicated behavior, your program is going to get ridiculous very soon, with endless lists of <code>digitalWrite()</code> and <code>if</code> statements. There are more efficient ways to do this... for instance using <code>for</code> loops, <code>switch</code> statements, and arrays.
=== Loops Part 4 - Looping over Multiple Digital Outputs ===* Specifically, looping across multiple Set up three or more digital outputssimliar to those in part 1. (work in pairs if you would like)[[Image:Three_lights.jpg|400px]]* Open File->Sketchbook->Examples->DigitalControl->LoopForLoopIteration* Same as single input above, connect however with multiple LED outputs.
* Compile, upload, and run the loop example.
* Try changing the <code>int timer = 100;</code> variable. As the comment in the program says, <code>// The higher the number, the slower the timing.</code>.
* Experiment with shorter and shorter timing--at some point you should no longer be able to see the individual LEDs turn 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. At what value for <code>timer</code> does it appear that all LEDs are on continually ____.
* Change the behavior of the loop: 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.
* DifferentlyAlternately, with only one output, how could you make a program that changes over time using a loop.
=== Thoughts ===
** what novel package or "frame" could change the meaning of a thing.
=== Part 4 - Multiple Digital Outputs ===
* Set up three or more digital outputs.
[[Image:Three_lights.jpg|400px]]