Divide into Subsystems and Test
Support inquiries at Parallax often have several commonalities. One of them is that an entire project was built and a huge program written to run the system. This makes troubleshooting incredibly difficult because it’s not readily possible to determine if the behavior is a result of the circuit, code and logic, or the physical environment. It’s best to divide the circuitry and code into stages so they can be made to function individually first, next with additional parts and finally as a complete system. This is called “subsystem assembly and testing”. Let’s do exactly that!
The two systems that should be tested independently are the QTI Line Follower and ColorPal. We’ll assume you’ve got the WS2812 LED and piezo speaker wired properly in your circuit.
First, if you don't want to recreate these programs by hand, download the zip archive containing the 3 blocks files you will need: Line Follow with AB360 ColorPal blocks files
QTI Line Follower
The BlocklyProp QTI Line Follower code is quite basic. Once you’ve assembled the ActivityBot with QTI Line Follower, put a few pieces of electrical tape down and see that it works with this Blockly code.
- Open a new project and upload the "QTI-LF-Simple" svg file from the archive you downloaded above, or create the project below to test your QTI Line Follower:
ColorPal Color Match Identifier
The Line Follower with Color-coded Turn Indicator program must be able to distinguish the color samples you are using from one another, and to associate them closely with your BlocklyProp source code. BlocklyProp has a block for exactly this purpose named compare colors. The compare colors block returns a value from 0 (opposite) to 255 (identical - perfect match) of a 24-bit color sample taken by the ColorPal. This block is found in the Values menu.
The goal is to match the ColorPal’s measured color against a value known by BlocklyProp so you can make decisions in your program.
Color 1 (left) is your various color samples, and Color 2 (right) is BlocklyProp’s color-picker choices.
- Open a new project and upload the "Color-Match-Identifier" svg file from the archive you downloaded above, or create a program that looks like the ColorPal Color Match Identifier shown below.
Choose the best match between your color samples (color 1) and a choice from BlocklyProp’s color-picker (color 2). Cycle through your various color samples and find the closest match from the color-picker. You’ll see the values in the Terminal window.
It helps to produce a small chart of your observations so you can have them handy in the full program:
Now you’ll build a program from the two above into the Line Follow with AB360 ColorPal program. Tune it and improve as you desire!
- Open a new project and upload the "LF-with-AB360-ColorPal" svg file from the archive you downloaded above, or recreate the program shown below.