Two Color LED module (029)

TWO COLOR LED(029)

Introduction:

In this blog we gonna talk about Two color LED(029)........diameter of 029 module is 3mm.LED module which includes a red and a green LED. They are connected via cathode. You need resistors for different voltages.

Things Required:
  • Arduino
  • Breadboard
  • Jumper wire
  • Two color LED (029)
CODE:


 int Red = 9;
 int Green = 10;
void setup() {
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);

}

void loop() {
  digitalWrite(9,HIGH);
  digitalWrite(10,LOW);
  delay(2000);

  digitalWrite(10,HIGH);
  digitalWrite(9,LOW);
  delay(2000);
}

or you all can use this code also

int Red =9;
int Green = 10;
int val;
void setup () {
  
  pinMode (9, OUTPUT); 
  pinMode (10, OUTPUT); 
}
void loop () {
   
   for (val = 255; val> 0; val--)
      {
      analogWrite (10, val);
      analogWrite (9, 255-val);
      delay(15);
   }
   
   for (val = 0; val <255; val++)
      {
      analogWrite (10, val);
      analogWrite (9, 255-val);
      delay (15);
   }
}

circuit:



Comments

Popular Posts