Blinking BiPolar LED

BiPolar LEDs have 3 three legs. One goes to ground, and the other 2 represents two different colors in the same LED. In my case, they are green and red. I have also used a variant of Arduino Nano in order to reduce the size of the experiment. Here’s the list of connections that I have made:

LED’s ground leg 220 ohm resistor
220 ohm resistor Arduino’s ground
LED’s one leg Arduino’s Digital Pin 12
LED’s other leg Arduino’s Digital Pin 13

My intention was to blink the colors alternatively. Green, red, green, red, green… with a 1-second delay in between. The code is as simple as one can imagine. There’s really nothing novel going on here:

int green = 12;
int red = 13;

void setup() {                
  pinMode(green, OUTPUT);     
  pinMode(red, OUTPUT);
}

void loop() {
  digitalWrite(green, HIGH);
  digitalWrite(red, LOW);
  delay(1000);           

  digitalWrite(green, LOW);
  digitalWrite(red, HIGH);
  delay(1000);   
}

Here’s the final outcome:

WP_20141105_21_04_47_Pro

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s