![]() ![]() The NACK seems to indicate that the read went wrong. ![]() Looking at my logic analyzer this is what I get: Wire.write(MCP23008_REGISTER_GPIO) // Select the GPIO register Wire.write(IO_ALL_PINS_INPUT) // Set all pins as inputĪfter which I attempt to read from it, by first addressing the GPIO register and then requesting a byte to read: inline uint8_t eeprog::_read() Wire.write(MCP23008_REGISTER_IODIR) // Set I/O direction Wire.beginTransmission(MCP23008_DEVICE_I2C_ADDRESS | MCP23008_SLAVE_I2C_ADDRESS) So I set it up for read as follows: #define MCP23008_DEVICE_I2C_ADDRESS 0x20 Writing to the device GPIO seems to work fine, and I'm a bit confused on how to read from the GPIO. The MCP23008 is wired to address 0x04, giving an effective device address of 0x24. I'm trying to read from an MCP23008 I/O expander using the Wire library over I2C. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |