We can deduce the rotation of the disc with 2 sensors by placing them at an angle of 90 degree.
Let us say we have 2 sensors named A and B.
Now there are two possible initial values of the sensor. Either Black or White.
Let us assume that Black - 0 and White - 1
The disc is rotating clockwise if Sensor A changes to the value of Sensor B and Sensor B becomes Sensor A XOR 1
The disc is rotating counter clockwise if Sensor A changes to the value of Sensor B XOR 1 and Sensor B becomes Sensor A.
This is explained with the below table.
Let us say we have 2 sensors named A and B.
Now there are two possible initial values of the sensor. Either Black or White.
Let us assume that Black - 0 and White - 1
The disc is rotating clockwise if Sensor A changes to the value of Sensor B and Sensor B becomes Sensor A XOR 1
The disc is rotating counter clockwise if Sensor A changes to the value of Sensor B XOR 1 and Sensor B becomes Sensor A.
This is explained with the below table.
Initial | Clockwise | Counter-Clockwise |
---|---|---|
A - Black B - Black | A - Black B - White | A - White B - Black |
A - Black B - White | A - White B - White | A - Black B - Black |
A - White B - Black | A - Black B - Black | A - White B - White |
A - White B - White | A - White B - Black | A - Black B - White |
0 comments:
Post a Comment