Introduction: How to Code a Line Following Sumobot
In this Instructable I will be detailing the process in which you can code a Sumobot from Parallax to follow a single black line.
Step 1: Materials and Tools
Step 2: Code Explanation
I have included a file to the code that should be used in the Sumobot, getting the Sumobot to use this code is as simple as downloading the code, opening it with the Basic STAMP editor, connecting the bot to the computer via the adapter included in the code and selecting run while your robot is powered by flipping the switch to the middle position (Powered but not executing code) If you do not turn your robot on, the program will give you an error, and will not upload.
Step 3: Modifying Code to Suit Your Needs
You can easily make the Sumobot turn for longer and shorter durations by modifying the "pulse" variables within the code (making them larger increases the time spent turning), however unless you are making very long and wide turns, this should not be necessary and I don't recommend it since it can be tricky getting the exact length of time you need to spend turning. You can also disable or add a start delay as well as speeding up or slowing down the robot. All of the lines of code and variables have comments explaining what they do, so it's a simple matter of changing the variables to suit your needs.
Step 4: Completion
Once you have used the provided code and if desired, changed variables to suit your need and uploaded it to the Sumobot it is simply a matter of turning it on and providing a black line for it to follow and it should work without issues. If you do encounter an issue with the Sumobot, such as the bot not turning when presented with a corner, try redownloading the code file as you may have accidentally typed an extra letter or number when modifying it.