So I wired up my display and I2C backpack to the SDA1 (23) and SCL1 (22) pins without realizing that none of the example scripts would run.. I can use the I2C advanced scanner that uses "wire1" using those pins and it sees the screen fine on address 0x27. When trying to use LiquidCrystal_I2C I cannot figure out how to change the pins to the other I2C bus. Where do I need to edit in the library to fix this?
Or do I need to edit the wire library to accomplish this?
I mean it's not like I'm just using normal DIO. Teensy specifically has two I2C channels. Just need to figure out how to point it to the secondary one.
I understand that, but the LiquidCrystal_I2C library is hardcoded to use Wire, not Wire1. So, you either have to use something else of change all the occurrences within the library
That is not going to work. You define USE_Wire1 in your main sketch so the header file does the proper thing, but the LiquidCrystal_I2C.cpp file gets compiled separately so USE_Wire1 will never be defined and won't use the alternative wire pins.
Re-edited to a full library : TeensyLiquidCrystal_I2C.zip (5.2 KB)
Change the 'Wire1.begin(I2C_MASTER, 0x00, I2C_PINS_22_23, I2C_PULLUP_EXT, 400000);' in the .cpp file to match your Teensy.
If you use the hd44780 library and the hd44780_I2Cexp i/o class you can use a #define to remap the "Wire" object name to some other name from your sketch.
And yes while this will not work for the LiquidCrystal_I2C library it does work for the hd44780 library.
You can "trick" the hd44780_I2Cexp i/o class to use Wire1 instead of Wire.
You simply use a #define before you include the hd44780 header files.
#define Wire Wire1
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip
Just keep in mind that this trick will only work if your sketch does not also ever want or need to also access the Wire object.
BTW,
In the near future there will be some updates to the hd44780 library that will allow the user to specify the Wire library object when defining the lcd object.
It will be much cleaner and work with any i2c/Wire library and allow the concurrent use of multiple i2c buses that need to use multiple Wire objects.
Shoot. You guys are awesome. I ended up ripping my project apart and resoldering to use the other pins. Hopefully your work will help other people who are using both I2C lines.