Hardware Required:
- Arduino Uno board
- LED (x2)
- 330 ohm (x2), 10 K ohm resistors
- Pushbutton switch (N.O.)
- jumper wires
|
Schematic:
|
Project Steps:
- Assemble an LED and pushbutton, following the directions for project 4.
Add a second LED:
- Insert a second LED in the breadboard
- Connect a wire between the ground and the short pin of the second LED
- Connect a 330 ohm resistor between the D12 on the Arduino and the long-leg of the LED
Change the program to turn LED2 on when LED1 is off, etc..
- Save a copy of the Project4 code as a Project4b (file, save-as, enter new name)
- Change all of the "LED" variables to "LED1"
- Copy each line containing "LED1" and paste as a new line immediately following it.
- Change "LED1" in each of the duplicate lines to "LED2", for example:
const int LED1 = 13; const int LED2 = 13;
- Change the Digital Output used for LED2 to 12 (const int LED2 = 12;)
- Change the lines that turn LED2 on and off to the opposite of what LED1 has:
digitalWrite(LED1, HIGH); digitalWrite(LED2, LOW);
- Verify your code and upload to the Arduino.
|
For more assistance contact Technical Support
here.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.