Changes

Classes/2010/VIS147A/Lab7

1,162 bytes added, 16:33, 23 February 2010
Part 1 - Simple Digital Out
* (Slow down the timing if you need to, to measure these).
* Change the timing in some way. (HINT: the <code>delay(1000)</code> statement in the Blink example is what sets the time on and time off). Using what you know, create a different pattern or sequence of activation for the LED. (Massimo Banzi: 'One Circuit, A Thousand Behaviors' p 45-52).
==== Digital Out Code ====
* In the simple blink example, this code
<code>
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
</code>
is what creates the behavior: half the time on, half the time off.
* The <code>digitalWrite(ledPin, HIGH)</code> turns on the LED
* <code>digitalWrite(ledPin, LOW)</code> turns off the LED.
* What is this actually doing? The <code>HIGH</code> is setting that output pin to High or +5V. You can measure this with your multimeter while the example is running.
* Similarly, the <code>LOW</code> is setting that output pin to LOW or GND (0V). Again, this is measurable with the multimeter.
* This is where your programmable, internal world of the microcontroller is interfacing with the hardware, LED world of intro to electronics.
* Other code: We needed to do some setup first <code>pinMode(ledPin, OUTPUT)</code> so the microcontroller knows whether to use those pins as inputs or outputs. After that, output is simply a matter of <code>digitalWrite</code> calls.
=== Part 2 - Simple Digital In ===