Changes

Week 2 Lab

558 bytes added, 16:03, 7 April 2009
Changing the Behavior
# Connect your switch circuit to on if the digital I/O pins, and change <code>inputPin</code> in the button program to this number. (Mine is Pin 7)
=== Changing the Behavior Some Programming ===
* In the simple blink exampe, this code here:
<code>
</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 pin to High, 1, True, +5V.
* similarity, the <code>LOW</code> is setting that pin, to Low, 0, False, 0V or GND.
* This is where your programmable, internal world of the microcontroller is interfacing with the hardware, LED world of intro to electronics.
* So what can we change?
* You could insert your own code, for instance
<code>
* to get a "long-short-long-short" blinking.
** Try this out.
*Try some other variants..As you add more behavior here, things are going to get ridiculous very soon. * What are more efficient ways to do you know this, use For loops or Arrays?arrays.
=== Loop (Optional) ===