xreef / PCF8575_library

i2c 16bits digital expander with i2c digital expander for Arduino, Raspberry Pi Pico and rp2040 boards, esp32, SMT32 and ESP8266. Can read write digital values with only 2 wire. Very simple and encoder support. Uncommet NOT_SEQUENTIAL_PINOUT define to have pins like datasheet and not sequential one.
MIT License
53 stars 19 forks source link

create array of PCF8575 #8

Closed ear9mrn closed 2 years ago

ear9mrn commented 2 years ago

I would to declare an array of multiple PCF8575 devices within a struct, something like:

PCF8575 PCF[DEVICES];

Then, in another part of my code do something like:

PCF[0].digitalRead(PINNUM);

I cannot figure out how to do this with this library as it appears at minimum I need to assign an address with the constructor.

Any suggestions would be greatly appreciated.

Thanks.

xreef commented 2 years ago

Ops, sorry I lost this message.

You can find some examples here https://www.mischianti.org/forums/topic/more-than-one-pcf8574-expander/

Bye Renzo