I've read through about 100 of the search results for this topic, and haven't been left satisfied.
I've got a 16x2 Adafruit LCD, Shield Kit. Firstly, I know it is i2c, and that the ''default'' HelloWorld sketch will not work, as it uses digital pins etc.
I've got the i2C library, and installed it correctly, compile fine, and when I upload it, heres what happens:
The BACKLIGHT (blue) lights up, perfectly, but the top lines are just white boxes, no text, or the time below it.
I had a similar problem but with a backpack. Firstly I used Nick Gammon's I2C Scanner to ascertain the device address, and then tried three different libraries until I found one that worked fine. The library examples assume an address of 0x20, mine was 0x27.
SOLVED....same problem as dannable, there are several libraries but only one works
Mine was the one that downloads as :
Adafruit-RGB-LCD-Shield-Library-master
and the example that worked is:
/*********************
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 columns and rows:
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(WHITE);
}
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()/100);
uint8_t buttons = lcd.readButtons();
if (buttons) {
lcd.clear();
lcd.setCursor(0,0);
if (buttons & BUTTON_UP) {
lcd.print("UP ");
lcd.setBacklight(1);
}
if (buttons & BUTTON_DOWN) {
lcd.print("DOWN ");
lcd.setBacklight(0);
}
if (buttons & BUTTON_LEFT) {
lcd.print("LEFT ");
lcd.setBacklight(1);
}
if (buttons & BUTTON_RIGHT) {
lcd.print("RIGHT ");
lcd.setBacklight(1);
}
if (buttons & BUTTON_SELECT) {
lcd.print("SELECT ");
lcd.setBacklight(1);
}
}
}