When I use digitalWrite(selectPin[2], 1 >> 2 & 1)
The result is: digitalWrite(selectPin[2], 0 ) Pin is set LOW. Remark: Shift occurs.
Serial.Print(1 >> 2 & 1 ) shows 0.
However
Calculating 2 & 1 bitwise gives a result 0. No Shift should uccur. Pin must be set to HIGH
What is the difference?
ToBr
I copied the a) code from an article, and it works, also code c) works
In my calculation I calculated first 2 & 1, it gives 0 as a result.
My conclusion: without ( ): first Bitwise shift, then Bitwise AND.
Indeed better to use ( ) to prevent miscalculations.
Where can I find an overview of the order in calculation?
I know the rule MVDWOA.
But what about the comparison operators, boolean operators, bitwise ..., compound.
What about spaces? Are they important?
Thanks for your help.
ToBr