The Alpha Geek – Geeking Out

Project #7: RGB LCD Shield – Bi-Color LED – Mk09

Bi-Color LED

Bi-color LEDs contain two different LED emitters in one case. There are two types of these. One type consists of two dies connected to the same two leads antiparallel to each other. Current flow in one direction emits one color, and current in the opposite direction emits the other color. The other type consists of two dies with separate leads for both dies and another lead for common anode or cathode so that they can be controlled independently. The most common bi-color combination is red/traditional green, however, other available combinations include amber/traditional green, red/pure green, red/blue, and blue/pure green.

Super Bright BiPolar LEDs

Package of 12 super bright Red/Green jumbo T1 3/4 5mm LEDs. These have a diffused frosted lens and 3 long leads. Prime 100% perfect and bright. CODE 7: 100% Prime Parts. Stock # GP55

DonLuc1808Mk02

1 x RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
3 x Bi-Color LED GP55
3 x 270 Ohm Resistance
3 x 330 Ohm Resistance
3 x Jumper Wires 3″ M/M
7 x Jumper Wires 6″ M/M
1 x Size Breadboard
1 x USB Cable A to B

Arduino UNO

LG3 – Digital 5
LR3 – Digital 4
LG2 – Digital 3
LR2 – Digital 2
LG1 – Digital 1
LR1 – Digital 0
GND – GND

DonLuc1808Mk02p.ino

// ***** Don Luc *****
// Software Version Information
// Project #7: RGB LCD Shield – Bi-Color LED  – Mk09
// 8-02
// DonLuc1808Mk02p 8-02
// RGB LCD Shield
// Bi-Color LED

// Include Library Code
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

// RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();
#define GREEN 0x2

// Bi-Color LED
int iLR1 = 0;      // LED Red 1
int iLG1 = 1;      // LED Green 1
int iLR2 = 2;      // LED Red 2
int iLG2 = 3;      // LED Green 2
int iLR3 = 4;      // LED Red 3
int iLG3 = 5;      // LED Green 3

void loop() 
{

  // Bi-Color LED
  isBiColor();

  delay(1000);
  
  // Clear
  RGBLCDShield.clear();
  
}

getBiColor.ino

// Bi-Color LED
void isBiColor()
{
   
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("Bi-Color LED");         // Bi-Color LED

  // Bi-Color LED
   
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1x- L2x- L3x-");      // Bi-Color LED Red

  digitalWrite(iLR1, HIGH);                  // LED Red 1
  digitalWrite(iLG1, LOW);                   // LED Green 1
  digitalWrite(iLR2, HIGH);                  // LED Red 2
  digitalWrite(iLG2, LOW);                   // LED Green 2
  digitalWrite(iLR3, HIGH);                  // LED Red 3
  digitalWrite(iLG3, LOW);                   // LED Green 3

  delay( 2000 );

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1-x L2-x L3-x");      // Bi-Color LED Green

  digitalWrite(iLR1, LOW);                   // LED Red 1
  digitalWrite(iLG1, HIGH);                  // LED Green 1
  digitalWrite(iLR2, LOW);                   // LED Red 2
  digitalWrite(iLG2, HIGH);                  // LED Green 2  
  digitalWrite(iLR3, LOW);                   // LED Red 3
  digitalWrite(iLG3, HIGH);                  // LED Green 3

  delay( 2000 );

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1xx L2xx L3xx");      // Bi-Color LED Red-Green

  digitalWrite(iLR1, HIGH);                  // LED Red 1
  digitalWrite(iLG1, HIGH);                  // LED Green 1
  digitalWrite(iLR2, HIGH);                  // LED Red 2
  digitalWrite(iLG2, HIGH);                  // LED Green 2  
  digitalWrite(iLR3, HIGH);                  // LED Red 3
  digitalWrite(iLG3, HIGH);                  // LED Green 3

  delay( 2000 ); 
  
}

setup.ino

// Setup
void setup() 
{

  // set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc");           // Don luc
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Bi-Color LED");      // Bi-Color LED
  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // Bi-Color LED
  pinMode(iLR1, OUTPUT);                   // LED Red 1
  pinMode(iLG1, OUTPUT);                   // LED Green 1
  pinMode(iLR2, OUTPUT);                   // LED Red 2
  pinMode(iLG2, OUTPUT);                   // LED Green 2
  pinMode(iLR3, OUTPUT);                   // LED Red 3
  pinMode(iLG3, OUTPUT);                   // LED Green 3
  
}

Don Luc

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives