Meadow.Core.Samples icon indicating copy to clipboard operation
Meadow.Core.Samples copied to clipboard

MCP23008 default i2c address has changed. Sample not working anymore.

Open kaarew opened this issue 2 years ago • 0 comments

The MCP23008 sample on hackster does not work anymore. (https://www.hackster.io/wilderness-labs/expanding-io-ports-on-meadow-with-an-mcp23008-23a512) The default I2C address in Meadow.Foundation.ICs.IOExpanders.MCP23008 has changed from 7 (A2-A0 is all high as in the hackster article) to 0 (all connected to GND). Actually, to get this sample to work, you have to use address 39, because there's a magic 32 value that has to be added as well. That's not very intuitive for beginners. Earlier there was a nice constructor that took a boolean value for each address pin. That was a much better interface. Please consider adding back a constructor like this: public Mcp23008(II2cBus i2cBus, bool A2, bool A1, bool A0, IDigitalInputPort interruptPort = null, IDigitalOutputPort resetPort = null) : base(i2cBus, (byte)(32 + (A2 ? 4 : 0) + (A1 ? 2 : 0) + (A0 ? 1 : 0)), interruptPort, resetPort) { }

Thanks!

kaarew avatar Apr 23 '23 19:04 kaarew