Multiple i2c devices on separate i2c ports?

Hi all,

This might be a silly question but I haven't been able to figure it out. I have an IMU and OLED display connected to i2c-0 and i2c-1 ports on a Teensy. I'm using the Wire library which is allowing me to receive comms from the IMU as it is on the default i2c pins. But I would appear that I can't read the OLED because it's on different i2c lines. Do I have to modify a library to do this?

(I would rather not change the hardware if it is possible through software -- so I would not like to put them both on the same i2c port).

Any advice would be appreciated! Thanks

Thanks.

why? I2c is multi-slave bus, connecting several clients to the single bus is standard procedure

It may be possible, depending on the library you use. The i2c-1 port probably has a Wire1 object. If the library allows you to specify the Wire object to use in its constructor, it should be pretty easy.

For example

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire1, OLED_RESET);

But if the library is hard-coded to use the Wire object, then the library will need to be changed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.