This second test will verify that your SumoBot robot’s QTIs return the correct 1/0 measurements used in competition programs for detecting black/white surfaces. Instead of writing this program, you will download a pre-written example program, and then open it with BlocklyProp Solo.
QTIs Front Test BW Detect.svg [1]
Instead of the 230 magic number, this test will simply verify that each QTI measures 0 when over the white border or 1 over the black surface.
The run function "QTIs Front" block makes the program complete the blocks in the QTIs Front function container before continuing on to the Terminal clear screen block.
The QTIs Front function block sets two binary digits in a variable named qtis with 1 indicating a black surface and 0 indicating white. The left of the two binary digits indicates the 1/0 black/white state of the left QTI, and the right indicates the state of the right QTI.
Examples:
The QTIs Front function compares the QTI measurements to that 230 threshold. If the measurement is below 230, the function sets a digit in the qtis variable to 0. If it’s above 230, it sets that digit to 1.
Links
[1] https://learn.parallax.com/sites/default/files/content/Sumo/qti/QTIs%20Front%20Test%20BW%20Detect.svg