l3g4200d-arduino
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Arduino library for the Pololu L3G4200D carrier board (deprecated; replaced by https://github.com/pololu/L3G)
h1. Arduino library for the Pololu L3G4200D carrier board

Version: 1.1.0
Release Date: 2011-12-12
"www.pololu.com":http://www.pololu.com/

*This library is deprecated; you should use the newer Pololu "L3G library":https://github.com/pololu/L3G instead, which also supports the L3GD20.*

h2. Summary

This is a library for the "Arduino":http://pololu.com/catalog/product/1616 that interfaces with the Pololu "L3G4200D 3-axis gyro carrier":http://www.pololu.com/catalog/product/1272. It makes it simple to read the raw gyro data.

h2. Getting Started

h3. Software

Download the archive from "GitHub":https://github.com/pololu/L3G4200D, 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.

h3. Hardware

The board for the L3G4200D can be purchased on "Pololu's website":http://www.pololu.com/catalog/product/1272.

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

pre. Arduino Uno/Duemilanove     L3G4200D Carrier
                    5V  ->  VIN
                   GND  ->  GND
          Analog Pin 5  ->  SCL
          Analog Pin 4  ->  SDA

pre. Arduino Mega                L3G4200D Carrier
                    5V  ->  VIN
                   GND  ->  GND
        Digital Pin 21  ->  SCL
        Digital Pin 20  ->  SDA

h2. Example Programs

Open an example code sketch by selecting File->Examples->L3G4200D->example_name

h3. Serial

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:

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

h2. 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@.

h2. Version History

* 1.1.0 (2011-12-12): Arduino 1.0 compatibility.
* 1.0.0 (2011-09-14): Original release.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。