Tuesday, June 19, 2012

Arduino control RGB LEDs

Arduino control RGB LEDs

Hardware
Arduino compatible Board from ETT model ET-BASE-AVR-EASY328 more info

RGB LEDs model SPNovaLED NMRTB-USD-AAB+ADE+Y2Z1-1 ( Dominant Semiconductors)


RGB LED spec
SPNovaLEDTM
Featuring a staggering brilliance and significant flux output, the SPNovaLED™ showcases the latest technological advent in this range. With its extremely high level of brightness and the ultra low high profile, which is only 1.5 mm are highly suitable for both conventional lighting and specialized application such as automotive signal lights, traffic lights, channel lights, tube lights and garden lights among others.

Features:
> Super high brightness surface mount LED.
> High flux output.
> 125° viewing angle.
> Compact package outline (LxWxH) of 6.0 x 6.0 x 1.5mm.
> Ultra low height profile - 1.5 mm.
> Designed for high current drive; typically 250 mA.
> Low junction-to-solder point thermal resistance; RTH js = 50 K/W.
> Qualified according to JEDEC moisture sensitivity Level 2.
> Compatible to IR reflow soldering.
> Environmental friendly; RoHS compliance.

Applications:
> Signage: full colour display video notice board, signage, special effect lighting.
> Lighting: architecture lighting, general lighting, garden light, channel light.

Download RGB LEDs Datasheet

Arduino code

/*
 Fading
 This example shows how to fade an LED using the analogWrite() function.
 */
#define REDPIN 9             // LED connected to digital pin 9
#define GREENPIN 10    // LED connected to digital pin 10
#define BLUEPIN 11        // LED connected to digital pin 11

#define FADESPEED 5

void setup()  {
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
}

void loop()  {
   int r, g, b;
 
  for (r = 0; r < 120; r++) {     // fade from blue to violet
    analogWrite(REDPIN, r);
    delay(FADESPEED);
  }
 
  for (b = 120; b > 0; b--) {      // fade from violet to red
    analogWrite(BLUEPIN, b);
    delay(FADESPEED);
  }
  for (g = 0; g < 120; g++) {   // fade from red to yellow
    analogWrite(GREENPIN, g);
    delay(FADESPEED);
  }
  for (r = 120; r > 0; r--) {        // fade from yellow to green
    analogWrite(REDPIN, r);
    delay(FADESPEED);
  }
  for (b = 0; b < 120; b++) {    // fade from green to teal
    analogWrite(BLUEPIN, b);
    delay(FADESPEED);
  }
  for (g = 120; g > 0; g--) {      // fade from teal to blue
    analogWrite(GREENPIN, g);
    delay(FADESPEED);                           
  }
}