SparkFun Line Follower Array Hookup Guide
Example Sketches
ReadBarOnly
This example exists to show all the forms of data collection that can be done with the library.
To use the sketch, select it from the 'examples' menu and load it onto an Uno compatible board. Open a serial terminal at 9600 baud and text of the raw data, position, and density should appear. Otherwise, it will proclaim that the communication has failed.
MostBasicFollower
This is an demonstration of line following capabilities using the RedBot mainboard and either chassis. It was designed for a dark line of about 3/4 inch width (spray paint or electrical tape) on a light background.
The sketch can navigate curved corners but not 90 degree corners! It's up to you to find a way to make it navigate. Also, this was designed to stop if the line is lost. There must be a way to seek partial line segments...
This example is being used in our demo video.
This sketch has a little state machine inside that reads the line, then goes to a state that calls drive functions, depending on some condition. It was designed to be simple on purpose. It's up to you to make a better system!
This blog post State Machines: blink.ino learns to snooze may help if you need a refresher on state machines.
AveragingReadBarOnly
This sketch was written to demonstrate how to get a pseudo-high resolution output from the array. Load the sketch and open a serial terminal at 115200 baud. The '*' is drawn on a scale as a rolling average filter of the getPosition() data.
It also allows you to look back in time to see what the robot previously went over.
This works by creating a circular buffer which stores fresh getPosition() data at a regular intervals, and by averaging the newest 10 entries in the buffer.
The buffer class is included as an extra with the library. See The Circular Buffer section.