Hi, I'm new to Arduino and I'm trying to get a LCD with a 'backpack' I2C expander board working with my Arduino Micro on a simple "Hello world" test. I ran the basic LED blinking examples and they worked fine.
I've been following this thread:
http://forum.arduino.cc/index.php?topic=170817.msg1269860#msg1269860
and trying to implement it. The I2C expander I'm using has the MCP23008 chip. I've added the New LiquidCrystal library V1.2.1.
I get no characters on the display and no backlight. That thread mentioned putting lcd(address,.....,LED,POSITIVE) as a method of lighting the backlight, but both LED and POSITIVE produce a compile error, saying they're "not declared in this scope". If I remove them it compiles and loads fine but does not display anything.
I've also tried the LiquidTWI library and the example included. That one was able to light and blink the backlight but not display characters.
Here's the code. I mapped the inputs to the LCD constructor (that's what you call the lcd(...) thing right?) according to the connections of my expander board and the byte mapping shown in the commented line right above it.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(address,EN,RW,RS,D4,D5,D6,D7)
LiquidCrystal_I2C lcd(0x24,6,5,4,0,1,2,3); // Set the LCD I2C address
// Creat a set of new characters
const uint8_t charBitmap[][8] = {
{ 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
{ 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
{ 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
{ 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
{ 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
{ 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
{ 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
{ 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
};
void setup()
{
int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));
lcd.begin(16,2); // initialize the lcd
for ( int i = 0; i < charBitmapSize; i++ )
{
lcd.createChar ( i, (uint8_t *)charBitmap[i] );
}
lcd.home (); // go home
lcd.print("Hello, ARDUINO ");
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print (" FORUM - fm ");
delay ( 1000 );
}
void loop()
{
lcd.home ();
// Do a little animation by writing to the same location
for ( int i = 0; i < 2; i++ )
{
for ( int j = 0; j < 16; j++ )
{
lcd.print (char(random(7)));
}
lcd.setCursor ( 0, 1 );
}
delay (200);
}
Any ideas what to do?