Pololu3piPlus32U4 library

Summary

This is a C++ library for the Arduino IDE that helps access the on-board hardware of the Pololu 3pi+ 32U4 Robot.

The 3pi+ 32U4 robot is a complete, high-performance mobile platform based on the ATmega32U4 microcontroller. It has integrated motor drivers, encoders, buzzer, buttons, line sensors, front bump sensors, an LSM6DS33 accelerometer and gyro, and an LIS3MDL compass. See the 3pi+ 32U4 user's guide for more information.

Installing the library

Use the Library Manager in version 1.8.10 or later of the Arduino software (IDE) to install this library:

  1. In the Arduino IDE, open the "Tools" menu and select "Manage Libraries...".
  2. Search for "3pi+".
  3. Click the Pololu3piPlus32U4 entry in the list.
  4. Click "Install".
  5. If you see a prompt asking to install missing dependencies, click "Install all".

Usage

To access most of features of this library, you just need a single include statement. For convenience, we recommend using the Pololu3piPlus32U4 namespace and declaring all of the objects you want to use as global variables, as shown below:

using namespace Pololu3piPlus32U4;
LCD lcd;
Buzzer buzzer;
ButtonA buttonA;
ButtonB buttonB;
ButtonC buttonC;
LineSensors lineSensors;
BumpSensors bumpSensors;
Motors motors;
Encoders encoders;

The IMU is not fully enabled by default since it depends on the Wire library, which uses about 1400 bytes of additional code space and defines an interrupt service routine (ISR) that might be incompatible with some applications.

Include Pololu3piPlus32U4IMU.h in one of your cpp/ino files to enable IMU functionality:

IMU imu;

Examples

Several example sketches are available that show how to use the library. You can access them from the Arduino IDE by opening the "File" menu, selecting "Examples", and then selecting "Pololu3piPlus32U4". If you cannot find these examples, the library was probably installed incorrectly and you should retry the installation instructions above.

Classes and functions

The contents of the library are contained in the Pololu3piPlus32U4 namespace. The main classes and functions provided by the library are listed below:

Dependencies

This library also references several other Arduino libraries which are used to help implement the classes and functions above.

Version history

  • 1.0.1 (2020-12-03): Moved code into src/ folder; continuous integration; fixed some warnings; added missing library dependence on PololuMenu.
  • 1.0.0 (2020-12-01): Customized example sketches for different 3pi+ editions. Reimplemented menus using the PololuMenu class. Added flipEncoders() method to the Encoders class to work better with the Hyper edition robot.
  • 0.2.0 (2020-11-25): Initial public release; motor demos only support Standard Edition.
  • 0.1.0 (2020-11-25): Initial release for production.
Pololu3piPlus32U4::Motors
Controls motor speed and direction on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Motors.h:17
Pololu3piPlus32U4::LineSensors
Gets readings from the five reflectance sensors on the bottom of the 3pi+ 32U4.
Definition: Pololu3piPlus32U4LineSensors.h:37
Pololu3piPlus32U4::ButtonC
Interfaces with button C on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Buttons.h:66
Pololu3piPlus32U4::ButtonA
Interfaces with button A on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Buttons.h:17
Pololu3piPlus32U4IMU.h
Include this file in one of your cpp/ino files for IMU functionality.
Pololu3piPlus32U4::BumpSensors
Gets readings from the two bump sensors on the front of the 3pi+ 32U4.
Definition: Pololu3piPlus32U4BumpSensors.h:24
Pololu3piPlus32U4::Buzzer
Plays beeps and music on the buzzer on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Buzzer.h:26
Pololu3piPlus32U4::LCD
Writes data to the LCD on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4LCD.h:36
Pololu3piPlus32U4
Top-level namespace for the Pololu3piPlus32U4 library.
Definition: Pololu3piPlus32U4.h:27
Pololu3piPlus32U4.h
Main header file for the Pololu 3pi+ 32U4 library.
Pololu3piPlus32U4::ButtonB
Interfaces with button B on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Buttons.h:39
Pololu3piPlus32U4::Encoders
Reads counts from the encoders on the 3pi+ 32U4.
Definition: Pololu3piPlus32U4Encoders.h:29