I’ve attached a Sparkfun COM-11442 to pins 8 and 9 of an April board and have it working, but with some really strange workarounds.
I started by adapting the Sparkfun sample i2c code, which didn’t work directly, but after hooking up an oscilloscope and experiencing a random accident that caused the LED to light up (accidentally shorting data to clock), I found a strange workaround.
The below code didn’t seem to do anything at all, although the result from the clear is 0, and if I manually short the pins, suddenly 1234 gets displayed.
`
hardware.configure(I2C_89);
// Clear the display
local result = hardware.i2c89.write(I2C_ADDR,“v”);
server.log("LED i2c write during clear was: "+result);
local digit1 = 1;
local digit2 = 2;
local digit3 = 3;
local digit4 = 4;
local data = format("%c%c%c%c", digit1, digit2, digit3, digit4);
local result = hardware.i2c89.write(I2C_ADDR, data);
server.log("LED i2c write result was: "+result);
`
That got me thinking, and I added to end:
// Really weird work around, number doesn't display unless I do this hardware.configure(I2C_89); hardware.configure(I2C_89);
One configure() didn’t do the trick, but twice caused the digits to appear. If I do the 4 character write() to update the display, I again have to do the extra hardware.configure()'s twice to get them to appear.
I feel like I am doing something wrong, since sending “v” to clear the display works just fine, but it seems like there is something done in the Arduino’s Wire.endTransmission(); that doesn’t get done at the end of an imp’s write().
Any ideas what I might be doing wrong and whether there is a better way other than doing the double configure()?