Gray Code

The important feature of gray code is that it exhibits only a single bit change from one gray code to another adjacent gray code. For instance, in going from decimal 7 to 8, the binary number change from 0111 to 1000 i.e all four bits change but the gray code are changed to 0100 to 1100 i.e only the 1st bit changes and all other bit remains same. This single bit change characteristics of gray code minimize the chance of error.

Easy way to write gray code

For 2 bit, write one bit gray code and put mirror below the code