# what is gray code and how does it work?

## what is gray code?

what is gray code? Do you know what gray code? What is gray code function and why use gray code?

Gray code is a code formed from a binary number arranged with the rule change from the previous number to the next number only changed 1 number or digits

In contrast to binary numbers that have weights (having LSB and MSB) in unknown code and can not be used for arithmetic operations

The function of the gray code is used to minimize the error on the sensor when taking input

After you understand about what is gray code then you need to know what are gray code function of and why use the gray code

## gray code function

The gray code is used to minimize errors on the sensor when retrieving input data

So essentially the sensor will take data in the form of gray code and then in processing gray code will be converted into binary code

The gray code is used because the gray code digit changes from the previous number to the next number only change 1 digit

Thus, very minimal mistakes are made

read too the way clocks work in digital circuits

The gray and binary code tables are as follows Because of its properties as above the gray code can be used to minimize or eliminate errors when reading input

## Why use gray code?

An example of using a gray code is the rotary encoder. Rotary encoder is used to read the rotation position and count the number of rounds. In the rotary encoder there are digits 0 and digit 1 and form the gray code If the reading using binary code then the possibility of a very high error for example is when there is a change from the number 0011 to 0100 or from 0111 to 1000 because the switch on the sensor is manual then sometimes the switch can experience errors

To avoid the mistake of the reader then used a gray code that avoids errors

For how to convert binary code into gray code will admin write in the next article