SMD RGB LED WITH ARDUINO

SMD RGB LED WITH ARDUINO


INTRODUCTION:

In this blog we gonna talk about SDM RGB LED ........SMD LED somewhat RGB LED we get different color by mixing original color (red,green,blue)..... most of us like to use sdm led because of it's high-performance, tricolor SMT LEDs are designed to work in a wide range of applications. A wide viewing angle and high brightness make these LEDs suitable for outdoor signage applications.

Things Required:

  • Arduino
  • SDM RGB LED
  • jumper-wire
  • breadboard

CODE:
int Led_Red = 10;
int Led_Green = 11;
int Led_Blue = 9;

int val;

void setup () {
  // Output pin initialization for the LEDs
  pinMode (Led_Red, OUTPUT); 
  pinMode (Led_Green, OUTPUT); 
  pinMode (Led_Blue, OUTPUT); 
}
void loop () {
   // In this for loop, the two LEDs will get different PWM-Values. 
   // Via mixing the brightness of the different LEDs, you will get different colors. 
   for (val = 255; val> 0; val--)
      {
      analogWrite (Led_Red, val);
      analogWrite (Led_Blue, 255-val);
      analogWrite (Led_Green, 128-val);
      delay (15);
   }
   // You will go backwards through the color range in this second loop.
   for (val = 0; val <255; val++)
      {
      analogWrite (Led_Red, val);
      analogWrite (Led_Blue, 255-val);
      analogWrite (Led_Green, 128-val);
      delay (15);
   }
}

you all use above code or this one

int redpin=10;
int greenpin=11;
int bluepin=9;


void setup() {
  

pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
}

void loop() {

colour(255,0,0);//red
delay(1000);
colour(0,255,0);//green
delay(1000);
colour(0,0,255);//blue
delay(1000);
colour(255,255,255);//white
delay(1000);
colour(170,0,255);
delay(1000);
colour(150,0,255);
delay(1000);
colour(200, 255,255);
delay(1000);
colour(200,0,0);
delay(1000);
colour(255,0,255);//magenta
delay(1000);
colour(255,255,0);//yellow
delay(1000);
colour(0,255,255);//cyan
delay(1000);
colour(255,255,125);//raspberry
delay(1000);
}
void colour(int redvalue,int greenvalue,int bluevalue)
{
  analogWrite(redpin,redvalue);
  analogWrite(greenpin,greenvalue);
  analogWrite(bluepin,bluevalue);
}

https://github.com/smritihalder/Robotics.ino



Comments

Popular Posts