how to use i2c_t3 and u8g2

Not open for further replies.


Well-known member
Hi, i'm in trouble with a project
i need to use the wire2 (for the pin 3 and 4 and it works with the scanner) to communicate with my display, but the u8g2 library need wire or something else ...
I'm sure it's a simple thing but I can not find a solution

Can someone point me to the right direction?
i have a ssd1306 display on the wire2 bus (3/4 on teensy 3.6), it require i2c_t3
if i use the example advanced_Scanner for i2c_t3, i see that the address of the display is 03XC
from what I understand, however, to make the display work with the library u8g2, i need the library wire.h that can not coexist with the i2c_t3
The difficulty is that the code is hard coded to use the WIRE object. So it would take changes to support other I2C objects.

Note: The Wire library supports the other objects as well. There is WIRE2, WIRE3... It would be nice if one of their constructors, allowed you to pass in a pointer to a TwoWire object, then you could pass in the one you want to use and could also use that solution for other Arduino platforms as well...

At times I have also thought about hacks to make it easier... That is make the WIRE object be settable to which actual hardware object it is actually using...
Something like: WIRE.setWireObject(Wire2); It would default to Wire1 or or maybe Wire0...

Note: The version of the U8g2 library I have, I installed using the Arduino Library manager...
That is correct: Wire.setSCL(3);

Will not work as pin 3 is not a valid SCL pin for the Wire object. It is valid for the Wire2 object...

Currently in order to use the Wire2 object instead of the Wire object, everything in the code that does something like Wire.transfer() needs to call Wire2.transfer() ... And likewise for all of the other calls...
Not open for further replies.