Changes

Classes/2010/VIS147A/Lab7

1,153 bytes removed, 16:33, 23 February 2010
Part 3 - Programming
* Compile, upload and run the Button program, verify that it works. You should see your external LED blinking in time with the program.
=== Part 3 - Notes on Programming ======= 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.
==== Digital In code ====
* In the Button example above, we do some setup