If you turn the polarity switch continually, you get the readings
+, 0, -, 0, +, 0, -, 0, ... ~= cos(2*theta)
Now set up the other polarity switch to be 45 degrees out of phase, and you
get:
0, -, 0, +, 0, +, 0, -, ... ~= -sin(2*theta)
So we have a 4-position angle sensor. By keeping track of the angle change, we
can deduce the speed and direction of the rotation.
Note the cycle is 180 degrees, so you may have to gear down the input by 2.
The question is: How do you feed the negative value into RCX? I am afraid that
some external circuit is unavoidable, so this solution may be not too
practical. :-(
Hao-yang Wang
|