What type of multiplexor?
GPIOs 1 and 3 are a very bad choice of pins…
Using this type of board may be a better solution…
And if you wanted some additional pins for use as physical buttons to control your relays without Blynk, and/or LEDs to indicate the status of each relay then you could daisy-chain multiple MCP23017 boards together to give upto 128 additional GPIOs…
I notice that your V4 widget button is writing m2-5 LOW, which would normally turn output D1 on.
Then, your V5 widget button is writing m2 HIGH and m3-5 LOW. This would normally turn output D8 on.
V6 turns m2, m4 and m5 LOW and m3 HIGH, which would normally turn output D4 on.
This assumes that you were correct when you said “m2 m3 m4 m5 would be s0 s1 s2 s3”. Are these multiplexor outputs (D1, D8 & D4) the ones you were expecting to be controlling with these combinations?
Also your else statement in each of these BLYNK_WRITE commands won’t turn the corresponding output off, because you’re not writing anything to the m2-5 pins when you pull your signal pin LOW.
TBH, it’s usually far easier to use a library designed for your multiplexor chip to simplify these data pin combinations, otherwise it all gets very messy when you start dealing with lots of pins.
Also, using the BLYNK_WRITE_DEFAULT() function (as shown in the two examples above) makes your code much neater and simpler.
You should also be careful when using Blynk.syncAll() as this only works with datasterams where you’ve enabled the Sync with latest server value every time device connects to the cloud option in the advanced datastream options. It’s far better to either list the pins you want to sync, or use a for loop to cycle through those pins.
Pete.