RedBot line follower using 2 sensors

Hi all,

The [line follower script on the SparkFun tutorial uses 3 sensors, but I’ve tried using [only 2 sensors and it works fairly well:

https://github.com/jaimeiniesta/arduino … /video.gif

The only problem I’d like to solve is that sometimes, after a turn, it gets stuck trying to continue straight. It looks like it can’t start the motors after stopping them, how can I solve this?](arduino-recipes/redbot_line_follower_two_sensors/redbot_line_follower_two_sensors.ino at master · jaimeiniesta/arduino-recipes · GitHub)](Getting Started with the RedBot - SparkFun Learn)

Since you are making your decisions of going left, right or straigt ahead based on the line-sensor values I would send them out also over the serial connection. So then you can check if the cause for the decision was a program bug (incorrect If-logic), or some physical fact that you didn’t perceive possible (sensor values out of range).

And make sure you know what values to expect when it detects a line, or no line. For both sensors!

EDIT: Motors getting stuck could simply be a mechanical issue. Are you sure everything works smoothly? Can a wild maneuvre in a track-corner cause something to jam?