I just got my Arduino starter kit hours ago and i began experimenting with it. This instructable is a good beginner tutorial that will teach you how to:
a. light up an LED
b. light up a RGB LED and use it's three colors
c. get information about what's happening in your arduino through the serial monitor
Of course, lighting up an LED is easy. There's the blink tutorial on how to blink an LED, but I modified it a little bit and jumped to lighting up your RBG LED and get the status of the Arduino through the serial monitor. Well, the arduino won't really tell you anything, but we'll tell it what to tell to us about what we told it to do. Basically, tell us what is the current color of the RBG LED.
This should help you:
a. be able to create status messages on your arduino to be view on the serial monitor so that you know what's happening
b. help you understand why sometimes we need to know what's happening
In this instructable, all you need is available in your Arduino Starter kit from Sparkfun.com. But here's a list:
1. RBG LED
2. 4 wires, preferably 1 black, 1 red, 1 blue, and 1 green
3. a 10kOhm resistor (optional)
4. an Arduino board, the one I used is the Arduino Duemilanove board with ATMEGA328
5. breadboard, or similar
Step 1: Wiring
Ok let's setup our circuit. It's just a simple circuit so I don't think it will be that hard. I've included really macro/close-up pictures so that you can properly wire them. Oh, and I've used Red wire for the red leg which connects to pin 6, green wire for the green leg which connects to pin 3, blue wire for the blue leg which connects to pin 5, and a black wire which connects to the GND leg and pin of the LED and board, respectively.
I've added a 10kOhm resistor so that I can dim the LED a little bit because without that, the LED shines really bright. I mean, REALLY bright. Although, if you choose not to put a resistor, that's fine. It will still work.
Step 2: Code and Serial Monitor
Now, upload this code into your arduino, then open the serial monitor to see the magic!
The code is attached, but you can copy paste it from this page www.zeighy.net/site-files/content/public/RBGSERIAL.html
Step 3: Final Remarks
After uploading the code to your Arduino, it should then be starting to work. Now, you can open the Serial Monitor and see the status. Also, every time you open the serial monitor, it resets the board.
Where do you go from here:
- you can now use other sensors and you can display status using the serial monitor. Check the reference on the Arduino website on how to display values form sensors
- build your own circuit and get status messages from the arduino so that you know what's happening and to know of something is going wrong.
- you might probably want to try out other methods you can use information you get from the serial connection.
Here's a sample run of mine: