Hi - looking at the sample sketch for the RELAY8 bard it looks as though only one really output can be enabled at once as the MCP23017 IC requires an 8bit value to be sent. How would you go about redesigning the sketch to allow a command to send an output HIGH or LOW on the MCP23017 but leave all the other outputs in their current state ?

Would this work (Python code below, but you get the idea).

Start with a known bit state, 00000000 (all bits off). I'm using decimal values in the example below but imagine their binary equivalents.

Then use a bitwise XOR to toggle a bit value at a known placeholder. You would reset the state variable with this new state and then send to the MCP21037. If this were to be done we could then toggle the relay outputs whilst easily being able to send a new 8-bit value to the MCP21037 leaving all other bits untouched.

The first operation toggles bit 0 on and off, the second operation toggles bit 7 on and off: