Real rotary position encoders use Gray code to prevent slight misalignments and border cases from being a problem. For some people, the term Gray code (named after [Frank Gray], the inventor ...