In response to a customer request I finally added internal pullup support in the Centipede Library ( for either the Centipede Shield or DIP MCP23017 chips).
Bonus tip: the MCP23017 supports up to 1.7MHz I2C speed, though the Arduino does not. However, the Arduino does support 400KHz I2C operation. For 16MHz Arduinos, simply add TWBR = 12; in your setup() function after Wire.begin();
the Arduino does support 400KHz I2C operation. For 16MHz Arduinos, simply add TWBR = 12; in your setup() function after Wire.begin();
If you really
want to make your library friendly, include code that does that automatically, for all the arduino variants. Oh yeah, and put the control registers back the way you found it, so I can use my XYZ device at whatever speed, and use the MCP23017 as fast as possible.
Thanks for sharing your code!
Yeah I might add support for it...you are correct that the TWBR register transparently and instantly changes the I2C speed. The prescaler registers work the same way. It would be interesting to write an I2C library that automatically negotiates to the highest speed that doesn't exhibit communication problems...could be very handy for long distance I2C without extra driver hardware.