Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
×1
SparkFun Common Cathode RGB LED
×1
SparkFun Common Anode RGB LED
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
×3
11026 02
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

Schematics for the project
Schematic is for Common Cathode. Put the common pin to 5V instead of GND for Common anode.
Rgb led schematic nxh560bdvq et208cfyxl

Code

Common Cathode LED codeC/C++
/***

    Made by - Techduino
    
    NOTE: New model RGB leds have green and blue leads interchanged. Please refer     to the datasheet of the correspoding led model from the seller's site.
    
    Use the Serial Monitor to enter the values for each color component out of 
    255.
    
***/

/***declaring RGB pins in PWM mode***/
int red = 11;
int green = 9;
int blue = 10;

/***brightness control variables***/
int redBrightness = 0;
int greenBrightness = 0;
int blueBrightness = 0;
  
  void setup() {
  
    Serial.begin(9600);         //initialising serial monitor
  
    /***Pin mode declaration***/
    pinMode(red, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);
    
  }
  
  void loop() {
    
    Serial.println("::Enter color brightness::");
    
    Serial.print("Red : ");         //for red
    while(Serial.available()==0){
    }
    redBrightness = Serial.parseInt();
    Serial.println(redBrightness);
    
    Serial.print("Green : ");         //for green
    while(Serial.available()==0){
    }
    greenBrightness = Serial.parseInt();
    Serial.println(greenBrightness);
  
    Serial.print("Blue : ");         //for blue
    while(Serial.available()==0){
    }
    blueBrightness = Serial.parseInt();
    Serial.println(blueBrightness);
    Serial.println("   ");
  
    /***sending variable voltages to RGB led***/
    analogWrite(red, redBrightness);
    analogWrite(green, greenBrightness);
    analogWrite(blue, blueBrightness);
    delay(3000);
    
    }
Common Anode LED CodeC/C++
/***

    Made by - Techduino
    
    NOTE: New model RGB leds have green and blue leads interchanged. Please refer     to the datasheet of the correspoding led model from the seller's site.
    
    Use the Serial Monitor to enter the values for each color component out of 
    255.
    
***/

/***declaring RGB pins in PWM mode***/
int red = 11;
int green = 9;
int blue = 10;

/***brightness control variables***/
int redBrightness = 0;
int greenBrightness = 0;
int blueBrightness = 0;
  
  void setup() {
  
    Serial.begin(9600);         //initialising serial monitor
  
    /***Pin mode declaration***/
    pinMode(red, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);
    
  }
  
  void loop() {
    
    Serial.println("::Enter color brightness::");
    
    Serial.print("Red : ");         //for red
    while(Serial.available()==0){
    }
    redBrightness = 255 - Serial.parseInt();
    Serial.println(redBrightness);
    
    Serial.print("Green : ");         //for green
    while(Serial.available()==0){
    }
    greenBrightness = 255 - Serial.parseInt();
    Serial.println(greenBrightness);
  
    Serial.print("Blue : ");         //for blue
    while(Serial.available()==0){
    }
    blueBrightness = 255 - Serial.parseInt();
    Serial.println(blueBrightness);
    Serial.println("   ");
  
    /***sending variable voltages to RGB led***/
    analogWrite(red, redBrightness);
    analogWrite(green, greenBrightness);
    analogWrite(blue, blueBrightness);
    delay(3000);
    
    }

Credits

Picsart 07 24 03 59 25 5z7brhie36
Techduino

Doing B.Tech. in Computer Science and Engineering from SRM University. A tech enthusiast and Arduino lover! 'Techduino' is my pen name.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Arduinomated Car Parking with Voice Assistance in Smartphone
Intermediate
  • 172
  • 9

Full instructions

Make an assistant which tells you about how much to drive backwards without any collision through your smartphone by Arduino and 1Sheeld.

Reducing Arduino Power Consumption
Intermediate
  • 119
  • 5

Full instructions

One the most important feature of portable electronics should be long battery life. We can reduce the current drawn by several ways.

Arduino Like Function on Kinetis K82 Freedom Stupid Board
Intermediate
  • 19
  • 2

Protip

1000 of K82 Freedom Boards are collecting dust because of the hobbyist unfriendly IDE, pump up the duds with easy Arduino-like functions.

Sigfox Forest Fire Detector
Intermediate
  • 2,590
  • 16

Full instructions

How to prevent forest from burning? A small Sigfox signal can prevent natural disasters. We will use an Arduino MKRFOX + a flame detector.

Analog-XY-Plotter-Output-to-HPGL-Translator
Intermediate
  • 330
  • 5

Translate analog X-Y plotter output to HPGL command stream.

Magic VR Hat
Intermediate
  • 667
  • 8

Wear the hat, get transported to different 360 VR experience.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog