RGB LED Controlled by Arduino

3.2K146


Intro: RGB LED Controlled by Arduino

Hello my friends, in this instructable i will show you how to make a basic RGB led controller with Arduino.

This control will let you to switch between seven colors, in 5 operational modes. To change the color or the mode you just have to press a button. So when you press the button the led will change the color, and after the seventh color it will change its operational mode. The order of colors and modes is the following:

  1. Manual Mode:
    1. Blue.
    2. Magenta.
    3. Red.
    4. Yellow.
    5. Green.
    6. Cian.
    7. White
  2. Automatic Faded Mode.
  3. Inverted Automatic Faded Mode.
  4. Automatic Temporized Color Change Mode.
  5. Inverted Automatic Temporized Color Change Mode.

Watch the video so you can see how it works!!!

STEP 1: Materials and Connections Diagram

For doing this controller you will need the following things:

  1. Arduino UNO Board.
  2. Common catode RGB LED x 1.
  3. Protoboard.
  4. Push Button normally open x 1.
  5. 10K Resistor x 1.
  6. 220 ohms Resistors x 3.

When you have all of the materials just follow the connections diagram posted here.

STEP 2: Uploading the Code to Your Arduino!!

When you are done with the hardware connections, just plug your Arduino board to your PC with the USB cable, and upload the sketch that you can download in the link below:

http://www.mediafire.com/file/cblzd828wgwdllk/Control_RGB_Psh_Buton.rar

Once you have done this, your RGB led should be shining in blue. Yayy!!!

So that's all my friends, if you have any doubt let me know on the comments and i will be happy to help you. Happy coding!!

4 Comments

hey its not working it is just flashing green
Hi,
i've tried your code into an Arduino Nano, and it does not work as expected. When the arduino is powered ON, the blue light shines, then it goes to red, then green for 1/4 of a second and then OFF. After about 10 secs, it lights up blue again and goes through the same pattern.

The button has no effect, i can remove it from the board and it still does the same.

I am totally new to Arduino and dont know anything about coding, i just need to used my arduino in this exact scenario you've created in order to control an RGB Led.

Thanks a lot if you can help
I only saw what code you included in the screenshot but it appears to me that you are overcomplicating the switch. Attach one side to ground, the other to a pin and set that pin to INPUT_PULLUP. No resistor needed, only one pin required. Will be HIGH when button is not pressed, and LOW when pressed.

Hi MaximilianK5, yes what you say it's true, i did this a long time ago, and didn't change the code, just uploaded as it was back then, and with the same hardware setup i used those days (2013), thanks for commenting. Have a nice day!