QTI Sensor Differences
Hi,
I was working on making a pair of wheel encoders from the QTI sensors, and I noticed something interresting.When I had both hooked up to the BS2 and ran the code, one would give a black value at about 300, while the other would give something at least a 3800, and both would give really big values for the holes in the wheel (empty space). It's always SenseRight that gives the smaller value. I've determined that the hardware must be the same, since I switched the leads and got the same problem. So, what's not right with my code? It's pretty much standard Parallax issue sample code.
I was working on making a pair of wheel encoders from the QTI sensors, and I noticed something interresting.When I had both hooked up to the BS2 and ran the code, one would give a black value at about 300, while the other would give something at least a 3800, and both would give really big values for the holes in the wheel (empty space). It's always SenseRight that gives the smaller value. I've determined that the hardware must be the same, since I switched the leads and got the same problem. So, what's not right with my code? It's pretty much standard Parallax issue sample code.
' {$STAMP BS2e} ' {$PBASIC 2.5} LeftLineSnsrPwr PIN 13 LeftLineSnsrIn PIN 12 RightLineSnsrPwr PIN 11 RightLineSnsrIn PIN 10 ClrEOR CON 11 SenseLeft VAR Word SenseRight VAR Word DO GOSUB Distance DEBUG HOME DEBUG "Encoders Test:", CR DEBUG DEC senseLeft, CR, DEC SenseRight, CLREOL PAUSE 100 LOOP Distance: HIGH LeftLineSnsrPwr HIGH LeftLineSnsrIn PAUSE 1 RCTIME LeftLineSnsrIn, 1, SenseLeft LOW LeftLineSnsrPwr LOW LeftLineSnsrIn PAUSE 1 HIGH RightLineSnsrPwr HIGH RightLineSnsrIn PAUSE 1 RCTIME RightLineSnsrIn, 1, SenseRight LOW RightLineSnsrPwr LOW RightLineSnsrIn RETURN
Comments
Just for kicks, try to define LeftLineSnsrPwr, LeftLineSnsrIn, RightLineSnsrPwr, and RightLineSnsrIn with 'CON' instead of 'PIN' and see if that makes any difference.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.