Working on a line following four wheeled robot using QTR-8RC

I have a four omni-wheeled robot with an Arduino Mega 2560 controlling it and a line follower. I have code to drive the robot and have run the example code that is in the libraries for the sensor, but how do I go about connecting the two. For example, should I be using if statements, like if the reflective array reads a value under 200 on sensor 1, the robot turns left? I am relatively new to both coding and robotics so any help would be greatly appreciated!


It sounds like you are trying to integrate the code for one of our QTR sensor arrays into your line-following code. Is that correct? If so, to answer your question, yes, you would need to read the sensors on the sensor array, compare the sensor readings to some threshold using conditional statements (or if/else statements), and execute some action (e.g. turn left). You might consider looking at the LineFollower code for our Zumo 32U4 robot in the examples folder on its GitHub page to get an idea of how you can use the sensor array readings to follow your line course. Please read the code comments to better understand how the code works.

- Amanda

Thank You! I think this will certainly help!