Test Front QTI Binary Values with Terminal

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.


  • Use the animation below as a guide to downloading the QTIs Test Front BW Detect.svg test code and opening it with BlocklyProp Solo.  

QTIs Front Test BW Detect.svg


  • Click the Load & Run (Save code to EEPROM)  button  to load the program into your SumoBot.


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.

  • While the SumoBot is still connected to your computer with USB, set the SumoBot on the sumo ring near the edge.
  • Monitor the terminal as you place the SumoBot’s QTIs over the black and white surfaces.
  • Verify that the measurement for each QTI is 0 when you place it over the white edge of the sumo ring and 1 when it’s over the black surface.
  • Verify this for both left and right QTIs using the animation as a guide.

How It Works

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.  


  • 00 - both QTIs over white surface
  • 01 - left QTI over white, right QTI over black
  • 10 - left QTI over black, right QTI over white
  • 11 - both QTIs over black

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.