I use a byte to store some flag like 10101010, and I would like to know how to verify that a specific bit is at 1 or 0.
10101010
1
0
byte THIRDBIT = 4; // 4 = 00000100 i.e third bit is set int isThirdBitSet(byte in) { return in & THIRDBIT; // Returns 1 if the third bit is set, 0 otherwise }