7-segment display code
bitRead(x, y) takes a value x, and looks at bit number y.

So, if:


y is the number 2;
x is 53 (binary number 0 0 1 1 0 1 0 1)

                                       ^


it looks at bit #2. Bits are counted from the right starting at 0 - I have indicated the bit in question above.

So, bitRead(53, 2) would return 1, since bit #2 in 53 is a 1.

In the above program, the clever programmer has coded whether to light or not light the LED for each segment of the display in a single byte for each possible number to display. The digit 8 has all seven of its LEDs lit up, so you'd expect the encoding for 8 to have lots of binary 1s in it - and sure enough, it does (B11111110)! And the digit 7 has only three segments lit up, so you'd expect only 3 bits to be set. Sure enough, B11100000.

The comment at the top describes what each of the bits represent - the last bit is the decimal point, which is never set...