Intro: A Beginner Arduino Project: Tri Colour by a Bi Colour LED
Hi and welcome to my 7th instructable. This time I am playing with my new TRduino duemilanove. Actually it is a clone of Arduino made by Thinnkware and have ATMega 328.
Arduino is a very good programmer and it is also open source(The thing I love about Arduino). We are making a Bi Colour LED to run three colours. You can see the video below on how it works. Enough talk, let's make it!
NOTE: All photos and videos are in HD.
Step 1: Things You Will Need
1. Arduino with USB Cable(Any Arduino will work)(http://www.radioshack.com/Arduino): 29.9$
2. Bi colour LED (http://www.radioshack.com/led): 2.71$
3. Jumper wire(http://www.radioshack.com/Jumper Wire): 5.99$
As my Arduino have male headers, I have to use breadboard and jumper wire. For those who have Arduino with female headers can directly connect LED to thier respective slot.
Step 2: Attaching LED
First for those who don't know what is an Bi-Colour LED I am teaching it here. A Bi-Colour LED have two colour. See In the picture, the left-foremost pin is the red one which is bend from top. The right-foremost pin is the green one which is straight. The middle pin is Cathode means negative means minus means -. The two pin are Anode means positive means plus means +.
OK, so attach the RED pin to 9th Digital pin of the Arduino. On Arduino, all digital pins are positive except two last pin after 13th pin.
Attach the green one to 10th and the middle one to Negative also known as GND.
Now building part ends here, attach your Arduino via USB and open your Arduino IDE.
Step 3: Coding
OK, so here is the code.
int led = 9;
int leds = 10;
Paste it or type it. After pasting or typing click Upload. Now we are going to understand the code. First we have typed int, means we are making a variable name led of type integer which is on pin 9. Same we are doing with leds but it is on pin 10. We don't need to mention GND. In setup we are registering the variable on our Arduino. In loop, means we are going to run this process infinite times or in simple language in a loop. DigitalWrite means we are giving work to the defined LED. HIGH means ON and LOW means OFF. Delay means for how much time we are going to keep the LED ON or OFF. 1000 means 1 second. First, we ON the Red colour, than ON the green when RED is ON. Than we off the Red colour and then we off the green colour.
See the video below and thanks for seeing my instructable and please vote for me Arduino Contest and sorry for my bad english.