Hi,
I use
expanderWrite(B11101111);
to set the PCF8574 pins.
But now I have to do it using 8 variables, or an array.
My varables:
P1=1;P2=1;P3=1;P4=0…
How should I do that?
Hi,
I use
expanderWrite(B11101111);
to set the PCF8574 pins.
But now I have to do it using 8 variables, or an array.
My varables:
P1=1;P2=1;P3=1;P4=0…
How should I do that?
Build up the variables into the byte to send using the bitwise OR and shifts If you variables only contain 0 or 1 you can use:-
byteToSend = P1 | (P2 <<1) | (P3 << 2) | (P4 << 3) … and so on