lesson2multicolored

Multicolor LED Tutorial

In this tutorial you'll create a simple circuit that can change the color of a light using a button. Below you'll find a diagram and link to the code.

Set up

    1. Open your Arduino software on your laptop
    2. Use a USB wire to connect your Arduino board to your computer
    3. Select the Arduino under Tools > Port

Schematic

When you setup the Arduino it's very important that all the wires go into the same spots as shown below. Remember that LEDs have a long side and a short side. For this LED the longest wire should go to ground.

RGB LEDs

In this project we're using a new type of led. In the past a LED was one color, but now this LED can show three colors. Each wire (except the longest) turns on a different color.

Code

With this new LED use the code below to program your arduino! Simply copy this file into your Arduino editor and upload it!

Stretch Goals:

    1. Can you get the LED to change between red and blue? Hint: The answer doesn’t require changing and code.
    2. Can you make it so the LED rotates between 2 colors every second?
    3. Can you make the color purple?
    4. Can you make it so the LED rotates between 3 colors every second?
    5. Go crazy! How many LEDs can you get on a board? Get them flashing at different intervals and colors. Make sure you use resistors so you don’t fry the LEDs.
    6. Use a button to turn all the LEDs on or off.