Grey code
also known as reflected binary code, is a method of representing numbers in a way that ensures a single bit change in the number results in only one bit change in the grey code representation.
This property makes it useful for constructing certain types of electrical switches,
such as rotary encoders, that can detect the position of a rotating shaft.
It is also sometimes used in error-correcting codes and other applications where it is important to detect small changes in a signal.
Grey code has the advantage of being particularly easy to generate and detect,
since only one bit changes at a time