Fun with RGB Led

Published Apr 20, 2021
 1 hours to build
 Beginner

This is my first project with RGB Led . So , let me introduce you to RGB Led . Bascially this led can produce many colours in itself . This is a simple circuit of RGB Led .

display image

Components Used

Arduino Nano
Arduino Nano
1
RGB LED
RGB LED
1
Connecting Wire Jumper Wires
Connecting Wire Breadboard wires
1
Description

Here is the code :

int red_light_pin= 11;
int green_light_pin = 10;
int blue_light_pin = 9;


void setup() {
 pinMode(red_light_pin, OUTPUT);
  pinMode(green_light_pin, OUTPUT);  
 pinMode(blue_light_pin, OUTPUT);
}

void loop() {
  RGB_color(255, 0, 0); // Red 
  delay(1000);
 RGB_color(0, 255, 0); // Green
  delay(1000);
 RGB_color(0, 0, 255); // Blue 
  delay(1000);
  RGB_color(255, 255, 125);  // Rasberry
   delay(1000);
  RGB_color(0, 255, 255); // Cyan

  delay(1000);  
  RGB_color(255, 0, 255); // Magenta 
  delay(1000);  
  RGB_color(255, 255, 0); // Yellow
  delay(1000);
  RGB_color(255, 255, 255); // White 
  delay(1000);
}
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{  analogWrite(red_light_pin, red_light_value);
  analogWrite(green_light_pin, green_light_value);  
analogWrite(blue_light_pin, blue_light_value);
}

So lets make the circuit 

Connections : RGB led 

red light pin to digital pin 11

green light pin to digital pin 10

blue light pin to digital pin 9

Cathode to Gnd

Refer to the circuit diagram for better understanding.

 

 

Downloads

e5ec135a-54d8-4ccb-bc45-57131f125280 Download
rgb led refrence pricture Download
Comments
Ad