Changes

Jump to: navigation, search

Classes/2010/VIS147A/Lab7

113 bytes added, 16:40, 23 February 2010
Part 3 - Multiple Outputs
* 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.
=== Part 3 - Multiple Outputs For Loop, Iteration ===* Set up six or more digital LED outputs similar to those in part 1. (work in pairs if you would like)
[[Image:Three_lights.jpg|400px]]
* You could set these up as a dot matrix display (say 2 X 3 or 3 X 2 or 3 X 3) rather than in a line.
* Open File->Sketchbook->Examples->Control->ForLoopIteration. This program is similar to the single input above, however with multiple outputs at 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.
** http://www.youtube.com/watch?v=mT13ZcpwYtA
* Extension: Instead of equal on/off timing, can you make the loop run in a different way? Spelling out key presses for a piano keyboard, something like that. 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?
 
=== Part 4 - Dot Matrix ===
* Working in pairs, set up six or more digital LED outputs. Set these up as a dot matrix display (say 2 X 3 or 3 X 2 or 3 X 3) rather than in a line. Technically you have 13 digital outputs to work with (4 X 3 dot matrix?).
* Experiment with code and output to get something to happen.
== Homework ==

Navigation menu