Support » Programming Orangutans and the 3pi Robot from the Arduino Environment » 5. Arduino Libraries for the Orangutan and 3pi Robot »
5.g. Pololu3pi - Sensor Library for the 3pi Robot
This library allows you to easily interface with the five infrared reflectance sensors on the 3pi robot. Note that in order to use this library, you must also include PololuQTRSensors.h in your sketch. You should have something like the following at the top of your sketch:
#include <Pololu3pi.h> // gives access to sensor interface functions #include <PololuQTRSensors.h> // used by Pololu3pi.h #include <OrangutanMotors.h> // gives access to motor control functions #include <OrangutanBuzzer.h> // gives access to buzzer control functions
Unlike the other Orangutan libraries, you must explicitly call the init() method to initialize your Pololu3pi object before using it.
All of the methods in this class are static; you should never have more than one instance of a Pololu3pi object in your sketch.
This library comes with three example sketches that you can load by going to File > Examples > Pololu3pi. There is a simple line-following example, a more advanced PID-based line-following example, and a basic maze-solving example.
For more information on creating line and maze courses, as well as a detailed explanation of the C versions of the demo programs, please see sections 6 and 7 of the 3pi User’s Guide.