Datasheet
Page 112· Applied Robotics with the SumoBot
Your Turn - Incorporating the Right QTI
Here's the interesting part, you can add another QTI measurement to the same block of
code that performed the time measurement on the left QTI. The routine will take
approximately the same amount of time, but you will be measuring two QTIs.
√ Add a variable declaration for the state of the right QTI.
qtiStateLeft VAR Bit
√ Add this code block right after the code that sets the threshold based on P9
measurements. It should be inserted just above the
IF threshold > 220 THEN
statement.
HIGH 7
HIGH 8
PAUSE 1
RCTIME 8, 1, time
threshold = (threshold + (time / 4)) / 2
√ Add the commands with ' <---Add comments to the existing code in the Main
Routine’s
DO...LOOP:
HIGH 9
HIGH 8 ' <--- Add
PAUSE 1
INPUT 9
INPUT 8 ' <--- Add
PULSOUT 5, threshold
qtiStateLeft = IN9
qtiStateRight = IN8 ' <--- Add
DEBUG HOME, ? qtiStateLeft
DEBUG ? qtiStateRight ' <--- Add
PAUSE 100
√ Save and run the program
√ Test the program and verify that both QTI's now indicate white tawara line with
0 or black ring surface with 1.