Gray code is well known and widely used in angular movement systems where angular positions have to be known. Gray code encoder can be constructed pretty easily by masked wheel where tracks are read with photocells.
Did you look at the picture and thought for yourself that gray code is the same binary code. Well, no… the main problem with binary systems was using binary code in tracks; there are many positions where several tracks change state simultaneously. This may result in an error. Actually, in gray code, only one track can change at the same time during rotation. So then, if an error occurs, the resulting error will be only one bit. Gray code is easy to convert to binary this task can be done by any microcontroller using a lookup table:
Also, you can convert Gray code to binary analytically. To convert from binary to Gray, start at the MSB and compare it to 0. If MSB is equal to0, then write 0 as the MSB for the Gray coded number, otherwise write 1. Next, compare the next MSB and compare it to the MSB. If they are equal, write a 0 in the Gray coded number; otherwise, 1. Then compare each bit in the binary number to the bit just to the left of it and write 0 for a true comparison and 1 for a false. This procedure continues until the LSB is compared with the second bit.
The image below shows a 5-bit rotation encoder, using a Gray-code pattern and an optical sensor.