Did you use 2 (or more) I/O expanders? (MCP23017)

I asked this question in the discussion about the “Adafruit_MCP23017” library (link) but got no reaction… :wink:

As I want to monitor the messages published by 20 Photons with one Photon, turning on status LEDs, I need about 60 GPIO pins.

If I could use four MCP23017 ICs, that would be perfect. On the I2C bus it should be possible to use eight of these.

I tried my monitoring sketch out with one, using the Adafruit_MCP23017 library but cannot figure out how to control more than one chip.

Can anybody get me on the way?
Or is it just not possible with this library?

If you had a look at the Adafruit_MCP23017.h, you would have seen this void begin(uint8_t addr); constructor that takes the address your object should refer to.
Create one object per chip and just do the stuff you’d do with a single one.

3 Likes

Thanks for your reply @ScruffR !
That’s also what @jbeacon explained in the library discussion (LINK)

I will do my best, but I’m not sure if I can figure it out how exactly to do this.
Actually, I was hoping for an example… :wink:

PS: I’m only a hardware engineer who has programming in “wiring” as a hobby…

I’ve used 2 or more mcp23008 and mcp23017 without problems.

If I remember it right you just use mcp.begin (x) , x being set by the address pins.

1 Like

Thanks @peter_a this is a fantastic community with brilliant brains!
I am one step closer to my target…

=> See the rest of the discussion HERE

This is the reason why double-posting is frowned upon!
You are tying the energy of two or more people to answer the same question multiple times.

2 Likes