Loading... Please wait...

Arduino-RGB-Color-Mixer

Arduino-RGB-Color-Mixer

For the Arduino RGB Color Mixer Project your going to need the four items pictured below.

1 - Arduino RGB LED Module

3 - Arduino Tactile Switches

11 - Arduino Jumper Wires Male-Male

1 - Arduino

rgbled.jpgtacbutton.jpgjumper.jpgarduino.jpg

Now that we have all are parts in place, let's hook up our main GND (ground) connection. Connect Arduino GND Pin to the GND Rail (blue) on your breadboard.

firstgndconnection.jpg

 

Next, we'll make four more GND connections. One from the (-) Pin on the RGB LED Module to the GND Rail on your breadboard. The following three connections are from the the push buttons. Connect each top-right button leads to the GND Rail as well. Great your now finished with grounding.

secondgndconnections.jpg

 

Time for the Arduino Digital Pins connections. In this step the will be three connections. First, connect Arduino Pin 9 to the 'B' Pin one the RGB module. Secound, connect Arduino Pin 10 to the 'G' Pin. Third, connect Arduino Pin 11 to the 'R' Pin.

pwmconnections.jpg 

 

Ok, Time to connect our three buttons into the ciruit. All three connection from the Arduino board to the buttons will be made to the lower-left button Pins.

First, connect Arduino Pin 5 to the third button on your breadboard. Secound, connect Arduino Pin 6 to the middle button Pin. Third, connect Arduino Pin 7 to the first button.

pwmbuttonconnections.jpg

Your Project is complete! Now, time for the fun part! Copy the code below, past it into the Arduino IDE, and upload to your board. When you start pressing the the buttons you will see Red, Green and Blue begin to mix. 

Arduino RGB Color Mixer Code  

/*
Arduino Color Mixer
www.ResistorPark.com
*/

int redLEDPin = 11;
int greenLEDPin = 10;
int blueLEDPin = 9;

int redSwitchPin = 7;
int greenSwitchPin = 6;
int blueSwitchPin = 5;

int red = 0;
int blue = 0;
int green = 0;

void setup()
{
pinMode(redLEDPin, OUTPUT);
pinMode(greenLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
pinMode(redSwitchPin, INPUT_PULLUP);
pinMode(greenSwitchPin, INPUT_PULLUP);
pinMode(blueSwitchPin, INPUT_PULLUP);
}

void loop()
{
if (digitalRead(redSwitchPin) == LOW)
{
red ++;
if (red > 255) red = 0;
}
if (digitalRead(greenSwitchPin) == LOW)
{
green ++;
if (green > 255) green = 0;
}
if (digitalRead(blueSwitchPin) == LOW)
{
blue ++;
if (blue > 255) blue = 0;
}
analogWrite(redLEDPin, red);
analogWrite(greenLEDPin, green);
analogWrite(blueLEDPin, blue);
delay(10);
}

newsletter

Copyright 2019 Resistor Park. All Rights Reserved.
Sitemap | BigCommerce Design by PSDCenter