Go Down

Topic: Multiple I2C LCD's (Read 2 times) previous topic - next topic

hemmi25

I am unable to get multiple I2C displays working.  I am using the LCDi2cNHD.h library.  When I try 2 LCD's, everything displays on the second LCD.  Here is a simple code.  I know the I2C addresses are correct, because if I test each one individually they work correctly.  Any help?  Thanks

Code: [Select]
#define VERSION "1.1"
#include <Wire.h>
#include <inttypes.h>

#include <LCDi2cNHD.h>                   
LCDi2cNHD lcd = LCDi2cNHD(2,16,0x50>>1,0);
LCDi2cNHD lcd2 = LCDi2cNHD(2,16,0x4C>>1,0);

uint8_t rows = 2;
uint8_t cols = 16;



void setup() {

  lcd.init();     
  lcd2.init();   

}


void loop()
{

     lcd.print("Hello World!");     
     lcd2.print("Hello World2!");     
 
}


bHogan

Just as a quick experiment, you might try this I2C LED lib:
http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/

Since it conforms to the same API, it should be easy to try.
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

hemmi25


Just as a quick experiment, you might try this I2C LED lib:
http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/

Since it conforms to the same API, it should be easy to try.


I tried that library, however it does not seem to work at all with my Newhaven Displays LCD.  Has anyone ever got multiple i2c lcd's working?

hemmi25

I was able to get 2 I2C lcd's working.  I gave up on the libraries, and just used wire.h.  This code works without issue.




Code: [Select]
#include <Wire.h>

int lcd_addr = 0x50;
int lcd_addr2 = 0x4C;

void setup(){

  delay(1000);

  Wire.begin();
   
  lcd_addr = lcd_addr >> 1;
  lcd_addr2 = lcd_addr2 >> 1;

 
  Wire.beginTransmission(lcd_addr);
  Wire.send(0xFE);
  Wire.send(0x51);
  Wire.endTransmission();

  Wire.beginTransmission(lcd_addr2);
  Wire.send(0xFE);
  Wire.send(0x51);
  Wire.endTransmission();
 

  delay(2000);

 
  Wire.beginTransmission(lcd_addr);
  Wire.send("This is LCD1");
  Wire.endTransmission();
   
  Wire.beginTransmission(lcd_addr2);
  Wire.send("This is LCD2");
  Wire.endTransmission();

}



void loop(){
   
}

asselinpaul

Have you tried to follow this tutorial: http://www.ladyada.net/products/i2cspilcdbackpack/
I got two i2C lcd working with the code.
Are you using Standard HD44780 LCDs or another type?
Paul

hemmi25


Have you tried to follow this tutorial: http://www.ladyada.net/products/i2cspilcdbackpack/
I got two i2C lcd working with the code.
Are you using Standard HD44780 LCDs or another type?
Paul



No I have not tried that library.  I have everything working now with the wire library.  I may try this library on a future project.  Thanks

robtillaart

Quote
I have everything working now with the wire library.

Please post your working code for later reference,

tia rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up