Hello.
I have 4 16x2 LCD Displays all connected to the same I²C bus.
Their addresses are 0x20, 0x21, 0x22, & 0x23.
I am trying to get them to all show different information at the same time but the only one I can get to do anything is the one at 0x21.
I currently don't have any example sketched as I am trying to modify existing incomplete sketches.
I use the #include <LiquidCrystal.h> & #include <Wire.h> libraries.
I tried to use Wire.beginTransmission (0x21); & Wire.endTransmission (0x21); along with lcd.clear(); & lcd.write("Hello"); to no avail.
My LCD remains unresponsive.
I know it's a software issue. I just can't figure out the code, nor can I find an example code for using multiple LCD Displays.
This is a straight forward sketch that doesn't work.
I think it gets the point across of what I'm trying to do.
I have never tried to do multiple addresses on I²C before.
this is all just experimentation for possible future projects.
Thanks to some great members from The Geek Group, it was brought to my attention that 3 of my I²C LCD Controllers required a different library than the I²C LCD Board I've had for the last couple months.
Now with a modified test sketch, I managed all 4 LCD's to display test messages simultaneously.
/*
* Displays text sent over the serial port (e.g. from the Serial Monitor) on
* an attached LCD.
*/
#include <Wire.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal lcd0(0);
LiquidCrystal_I2C lcd1(0x21,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x22,16,2);
LiquidCrystal_I2C lcd3(0x23,16,2);
void setup()
{
lcd0.begin(16,2);
lcd1.init(); // initialize the lcd
lcd1.backlight();
lcd2.init(); // initialize the lcd
lcd2.backlight();
lcd3.init(); // initialize the lcd
lcd3.backlight();
Serial.begin(9600);
lcd0.print("Test 1");
lcd1.print("Test 2");
lcd2.print("Test 3");
lcd3.print("Test 4");
}
void loop()
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd1.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd1.write(Serial.read());
}
}
}
LiquidCrystal_I2C lcd1(0x21,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x22,16,2);
LiquidCrystal_I2C lcd3(0x23,16,2)
Then you are using the default constructor which I believe uses the pinout of the "YwRobot" type backpack.
If you were using the "LCM1602 A0 A1 A2" or other type adapters then you would have to specify the correct pin assignments on the constructor statement, as in the example on this page: http://arduino-info.wikispaces.com/LCD-Blue-I2C
I am using three 16x2 LCDs that were hacked out of old Networking equipment.
The 4th 16x2 LCD and I²C control board, I got together months ago, but I can't remember from where.
The chips used on the one I've been using for months and the three I got from the link above are completely different
so to run both in the same sketch, it requires both libraries and two different initialization codes.
If I initialize the older one with LiquidCrystal_I2C(0x20,16,2), the it doesn't respond but the others will.
It will only respond to LiquidCrystal (0) and in void setup() it will initialize with lcd.begin(16,2);