I’ve started putting together a script based on your great example you provided:
It’s very rough, and needs a lot of tidying up doing to it before trying it out.
At present it will hopefully monitor 5 footswitches, and in the future I will add an encoder in and add your code back in.
I’ve also ordered a few variants of those expander chips you suggested so eventually I’ll be able to add some expression pedal inputs too hopefully!
And finally a nice little i2c screen would be the icing on the cake