Using 16 x 2 LCD with RGB LCD shield kit and R3 Uno

by PierrePaul on Wed Dec 05, 2012 11:17 pm

I am trying to use a blue and white 16 x 2 LCD (pid 181) with a RGB LCD shield kit (pid 715) mounted to a R3 Uno. The upper row lights (squares) but the lower row doesn't. Am I using the wrong shield for the blue & white LCD ? Should I be using another sketch instead of the one below ? I have attached a pic of my project. Thank you.

[Edit - moderator - please use the 'code' button when submitting code]

Code: Select all | TOGGLE FULL SIZE
/*********************

Example code for the Adafruit RGB Character LCD Shield and Library

This code displays text on the shield, and also reads the buttons on the keypad.
When a button is pressed, the backlight changes color.

**********************/

// include the library code:
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

// The shield uses the I2C SCL and SDA pins. On classic Arduinos
// this is Analog 4 and 5 so you can't use those for analogRead() anymore
// However, you can connect other I2C sensors to the I2C bus and share
// the I2C bus.
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

void setup() {
  // Debugging output
  Serial.begin(9600);
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);

  // Print a message to the LCD. We track how long it takes since
  // this library has been optimized a bit and we're proud of it :)
  int time = millis();
  lcd.print("Hello, world!");
  time = millis() - time;
  Serial.print("Took "); Serial.print(time); Serial.println(" ms");
  lcd.setBacklight(BLUE);
}

uint8_t i=0;
void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);

  uint8_t buttons = lcd.readButtons();

  if (buttons) {
    lcd.clear();
    lcd.setCursor(0,0);
    if (buttons & BUTTON_UP) {
      lcd.print("UP ");
      lcd.setBacklight(RED);
    }
    if (buttons & BUTTON_DOWN) {
      lcd.print("DOWN ");
      lcd.setBacklight(YELLOW);
    }
    if (buttons & BUTTON_LEFT) {
      lcd.print("LEFT ");
      lcd.setBacklight(GREEN);
    }
    if (buttons & BUTTON_RIGHT) {
      lcd.print("RIGHT ");
      lcd.setBacklight(TEAL);
    }
    if (buttons & BUTTON_SELECT) {
      lcd.print("SELECT ");
      lcd.setBacklight(VIOLET);
    }
  }
}
Attachments
P1020109.JPG
Shield with R3, view 1
P1020109.JPG (116.77 KiB) Viewed 578 times
P1020106.JPG
Shield with R3, view 2
P1020106.JPG (90.58 KiB) Viewed 578 times
PierrePaul
 
Posts: 1
Joined: Wed Dec 05, 2012 10:22 pm

Re: Using 16 x 2 LCD with RGB LCD shield kit and R3 Uno

by adafruit_support_bill on Thu Dec 06, 2012 6:15 am

The shield works with all of our 16x2 LCDs. Post clear photos of the front & back of the shield & we'll check the assembly. If you can size them a bit larger that what you have posted here, we can see the soldering a little better.
User avatar
adafruit_support_bill
 
Posts: 28070
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 16 x 2 LCD with RGB LCD shield kit and R3 Uno

by Hackoholic on Fri Dec 28, 2012 6:51 am

Not sure if this was resolved privately or not but I saw something very similar to what was described. After building the shield and plugging it in, I adjusted the contrast pot almost all the way up and saw just the top row of cells and no backlight. Once I downloaded the library, properly renamed it and loaded up the "Hello World" sketch everything worked great and both rows displayed properly with a bright backlight. Before I loaded the sketch I was thinking something was wrong with the LCD but this appears to be normal behavior until a proper sketch is loaded to activate the backlight and display text on both rows.
Hackoholic
 
Posts: 4
Joined: Fri Mar 16, 2012 11:50 am