I'm having issue with Adafruit_LiquidCrystal library and the wire library.
The schematic :
I'm using a LCD display connected with the i2c backpack (like describe at- ... no-i2c-use). I've used it many times in my projects since few years and I'm very satisfied of this product.
This time I had a SparkFun Differential I2C Breakout in the i2c chain ().
Every thing is fine when nothing is requested on the i2c port of the sparkfun breakout. But when the other distant board is requesting data, there is some issue on the lcd display.
I've also use the i2C breakout on many projects without any issues. But the two together is not working.
The data are well transmitted between the 2 Sparkfun I2C breakout.
The code used is the i2c helloworld example with some addtionnal code for the i2c communication on the sparkfun breakout.
I've tried to put delay in the loop. It changes nothing.
Any ideas ?
- Code: Select all | TOGGLE FULL 25 July 2009
by David A. Mellis
*/
// include the library code:
#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"
int sendInts[2];
// initialize the library with the numbers of the interface pins
Adafruit_LiquidCrystal lcd(0);
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
Wire.begin(20); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
sendInts[0] = 123;
sendInts[1] = 456;
}
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);
}
//---------------------------------------------------
void requestEvent()
{
//Envoi d'un entier seul
/*int temp = int(watt);
byte msb = (temp) >> 8;
byte lsb = temp & 0x00FF;
Wire.write( msb );
Wire.write( lsb );*/
//Envoi d'une array d'entier
Wire.write((uint8_t*)&sendInts, sizeof(sendInts));
}