Hello
The most common way to get the value of a bit N is to shift N bits to the right, and mask the result with 1 so to keep only the right-most bit.
Example to get the value of bit 5
| 0b10010111 | |
| >> | 5 |
| = | 0b00000100 |
| & | 0b00000001 |
| = | 0b00000000 |
Code : uint8_t bit5 = (value >> 5) & 1;
As said you can use the bitRead macro (it will do exactly the same thing), but now you know how it works ![]()