lesson2multicolored
Multicolor LED Tutorial
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
- Open your Arduino software on your laptop
- Use a USB wire to connect your Arduino board to your computer
- Select the Arduino under Tools > Port
Schematic
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
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
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:
- Can you get the LED to change between red and blue? Hint: The answer doesn’t require changing and code.
- Can you make it so the LED rotates between 2 colors every second?
- Can you make the color purple?
- Can you make it so the LED rotates between 3 colors every second?
- 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.
- Use a button to turn all the LEDs on or off.