Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (36 sloc) 2.05 KB

Arduino library for the Pololu L3G4200D carrier board

Version: 1.0.0
Release Date: 2011-09-14


This is a library for the Arduino that interfaces with the Pololu L3G4200D 3-axis gyro carrier. It makes it simple to read the raw gyro data.

Getting Started


Download the archive from GitHub, decompress it, and drag the “L3G4200D” folder to your arduino-00xx/libraries directory. Then restart the Arduino environment, so the libraries can be updated to include the L3G4200D library and its examples.


The board for the L3G4200D can be purchased on Pololu’s website.

Make the following connections with wires between the Arduino and the L3G4200D:

Arduino Uno/Duemilanove     L3G4200D Carrier
                    5V  ->  VIN
                   GND  ->  GND
          Analog Pin 5  ->  SCL
          Analog Pin 4  ->  SDA
Arduino Mega                L3G4200D Carrier
                    5V  ->  VIN
                   GND  ->  GND
         Analog Pin 21  ->  SCL
         Analog Pin 20  ->  SDA

Example Programs

Open an example code sketch by selecting File→Examples→L3G4200D→example_name


This program continuously reads the gyro, communicating the readings over the serial interface. You can display the readings with the Arduino Serial Monitor.

Example output:

G X: 188 Y: -10 Z: -47
G X: 138 Y: -40 Z: -26
G X: 110 Y: -55 Z: 4

Library Reference

vector g
The last values read from the gyro.
void enableDefault(void)
Turns on the gyro in the default configuration.
void writeReg(byte reg, byte value)
Writes a gyro register with the given value. Register address constants are defined in L3G4200D.h.
byte readReg(byte reg)
Reads a gyro register and returns the value read.
void read(void)
Takes a reading from the gyro and stores the values in the vector g.
Jump to Line
Something went wrong with that request. Please try again.