-->
Page 1 of 1

Wire vs SSD1306Wire -> I2C conflict?

PostPosted: Thu Dec 23, 2021 6:21 pm
by Hairyloon
This ought to be simple.
I want to get inputs off a PCF8591 ADC and display them on an OLED display.
I'm using the thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays, but only because it was the first one I found that worked.
This is the code that I'm using to read the ADC, it seems to work fine.

Code: Select all  Wire.beginTransmission(0x48); // wake up PCF8591
  Wire.write(0x04); // control byte - read ADC0 then auto-increment
  Wire.endTransmission(); // end tranmission
  Wire.requestFrom(PCF8591, 5);
  value0 = Wire.read();
  value0 = Wire.read();
  value1 = Wire.read();
  value2 = Wire.read();
  value3 = Wire.read();

Except that it stops working if I initialise the display:
Code: Select allSSD1306Wire display(0x3c, 5, 4);
display.init();


After that, all my inputs read 128.
What do I need to do different?

Re: Wire vs SSD1306Wire -> I2C conflict?

PostPosted: Sun Dec 26, 2021 3:40 am
by rpiloverbd
Hello, I think you 'd better use Adafruit_SSD1306.h instead. This library can be used with wire.h without any problem.

Re: Wire vs SSD1306Wire -> I2C conflict?

PostPosted: Tue Dec 28, 2021 9:50 pm
by Hairyloon
rpiloverbd wrote:Hello, I think you 'd better use Adafruit_SSD1306.h instead. This library can be used with wire.h without any problem.


I was about to say:
I cannot get that one to work with this module at all.

Then I thought I'd better check everything first: had missed out the space between SDA and SCL in the Wire.begin() function. :oops: