LOL AHHH, you got me on that one My bad. Corrected above. Thank you @ScruffR
No worries - I realised you had your LOWs and HIGHs mixed up.
I have gone down the route @peekay123 suggested - each port has to have a sensor setup and then I just read those with a sensor setup and skip the others where it is not.
Thanks all - just wanted to check I wasn’t missing a trick!
@armor You mentioned you wrote the library for mcp yourself - have you shared it anywhere?
Not sure if @armor wrote it or not but there are MCP23008 libraries available under community libraries on build, just search community libraries for MCP23008 and you will find a couple.
Good idea @IOTrav - I tend to build locally so I hadn’t thought to look there.
For the record I found:https://github.com/pkourany/Adafruit_MCP23017_IDE for the 23017 (there are others)
@lbt I have implemented a MCP23008 library but only because I wanted a stripped down and my own version. As @IOTrav has mentioned there are community libraries for both MCP23008 and MCP23017 GPIO expanders. To re-cap if you use the MCP23017 - it has a facility to PULL-UP inputs but not PULL-DOWN like you get with the
pinMode() function. If you do not have a sensor attached or something that will pull the signal down to GND and you are looking for an active HIGH then you will get ghost HIGHs as the voltage on the pin will drift about. Further to my post in November about stray signals when sensors are not attached to GPIO pins I have implemented a physical pull down (to GND) 10K ohm resistor for each pin as I could not be certain of software switching pins out of use. Hope this helps.