After getting my project working with the OLED 12864 display on the default 9,600 UART, using UART12 on the Imp, I now need to use I2C, as I need to add a I2C memory chip to the bus and the other 4 are occupied.
Getting the UART code working was a breeze, looking at several examples, including Cap’t Slo.dk. I wrote several little functions such as clearScreen() and setFont() which send “CL” and “SF” to the display, respectively. The print() function sends “TT” + string + 0x00. This works perfectly using the UART but hardly at all with I2C. It will send some text strings to the display and clearScreen() works in some loops but not always.
Some examples show sending “0x01” after each command even though that is not mentioned in the documentation for the OLED. Removing it from the UART version made no difference. Adding it to the I2C code made no difference.
The OLED says it has an address of 0x27. A few lines that do a quick scan see it as 4E, which would seem correct. Writing to “0x27 << 1” returns 0. Disconnecting either clock or data produces an error. Adding 10K pull-ups makes nothing work at all. I have two displays giving identical results. Tried 10, 100, 400. The wires involved are 3" long. Nothing else connects to those pins.
I must be close as I never get a write error and I do get some text strings but this is not working at even 1% of how well the UART connection works. I2C.write() must be sending the “\x00” as that is what terminates the TT command.
What detail am I missing? Help!