Things used in this project

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

Schematics

Schematic is for Common Cathode. Put the common pin to 5V instead of GND for Common anode.
Rgb led schematic nxh560bdvq
Simulator for Common Cathode RGB LED.
Sorry, but I didn't got the one with the CA LED. No problem, only the code is different.

Code

Using Common Cathode RGB LED.C/C++
/***

    Made by - Naman Chauhan
    
    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);
    
    }
Using Common Anode RGB LED.C/C++
/***

    Made by - Naman Chauhan
    
    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

2fd5ba432333a4e4670bbb05074e9bfb
Naman Chauhan

Doing B.Tech. in Computer Science and Engineering. Have a good hold on C,C++ & Arduino. We have 30+ people group on Hackster!

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

Quadrature Encoder Demo
Easy
  • 64
  • 3

Full instructions

Use a 3D printed encoder wheel, LED, and 2 photocells to demonstrate how a quadrature encoder works.

Simple Dark Sensor
Easy
  • 69
  • 2

A simple dark sensor with or without Arduino.

Arduino Amiga Floppy Disk Reader
Easy
  • 3,239
  • 5

Work in progress

An Arduino powered floppy disk controller and reader for making disk images from old AmigaDOS floppy disks.

Simple RGB LED Light with Fade
Easy
  • 17
  • 1

A Simple RGB LED light on Arduino UNO with Fade.

Door Lock System with Arduino
Easy
  • 32
  • 1

This is a door lock security system made with Arduino.

Arduino Controlled USB Trackpad
Easy
  • 2,813
  • 4

Full instructions

I really want to make a Raspberry Pi laptop but just can't find the right size trackpad so in this project we will be salvaging an old one.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login