// An example to show how you can check a bit using & // and set a bit to 0 using & #include #include int main(void){ //Check bit in position 1 //msb * lsb //76543210 BITPOSITIONS uint8_t x = 6; //xxxxxxXx uint8_t mask = 0; //TODO // //--------- // uint8_t result = x & mask; if(result == 0){ printf("Bit at position 1 in %d is 0\n", x); } else { printf("Bit at position 1 in %d is 1\n", x); } // How could we set bit at pos 2 to 0? // * // uint8_t z = 5; //xxxxxXxx // mask = TODO; // // //--------- // // // result= z & mask; // printf("%hhu\n", result); return 0; }