Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • ActivityBot 360 Line Following with Color Sensing

ActivityBot 360 Line Following with Color Sensing

Programming Steps

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:

 

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.


Printer-friendly version
Building the Robot and Track
Prev

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress