This is an arduino IDE library to control the LSM303C. It can be configured to use I2C or half-duplex SPI.
This has been tested with Arduino Pro Mini.
- /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
- /src - Source files for the library (.cpp, .h).
- keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
- library.properties - General library properties for the Arduino package manager.
- MinimalistExample - The easiest configuration. Prints out sensor data with some sane default configuration parameters
- ConfigureExample - Same as MinimalistExample, except all of the configuration is exposed with easy to change options all spelled out
- Installing an Arduino Library Guide - Basic information on how to install an Arduino library.
- Product Repository - Main repository (including hardware files) for the LSM6DS3 Breakout.
- Hookup Guide - Basic hookup guide for the LSM303C Breakout.
- BOB-13303- LSM303C Breakout board
- V 1.0.2 -- Remove Wire.begin() from library into setup()
- V 1.0.1 -- Explicitly set the I2C speed for compatibility with faster clocks.
- V 1.0.0 -- Initial commit of Arduino 1.5+ compatible library.
Arduino libraries that implement this interface are guaranteed to to work interchangeably in sketches. If a project is started with 6-DOF IMU, but one realizes that the project really needs a 9-DOF sensor, the change is simple. Include the new header file, & change the type of the IMU object(s). All of the code written to the interface will still function. Here is a list of the functions provided by this interface:
status_t begin()
- initialize IMU to sane default valuesfloat readGyroX()
- read value from the gyroscope about x-axisfloat readGyroY()
- read value from the gyroscope about y-axisfloat readGyroZ()
- read value from the gyroscope about z-axisfloat readAccelX()
- read value from the accelerometer in x-axisfloat readAccelY()
- read value from the accelerometer in y-axisfloat readAccelZ()
- read value from the accelerometer in z-axisfloat readMagX()
- read value from the magnetometer in x-axisfloat readMagY()
- read value from the magnetometer in y-axisfloat readMagZ()
- read value from the magnetometer in z-axisfloat readTempC()
- read temperature of sensor in ˚Cfloat readTempF()
- read temperature of sensor in ˚Fstatus_t getStatus()
- read the status code of the previous operation
All functions other than getStatus()
will update the status code depending on how their operation went. Errors in the read functions can be detected by them returning NAN
or calling getStatus()
.
If an IMU doesn't support a set of functions, they will always return NAN
and set the status to IMU_NOT_SUPPORTED
.
Other, more advanced features may be available depending on the sensor. See the documentation for the particular sensor for information on advanced feature support.
- Create your repo
- pull /src/SparkFunIMU.h into it
This product is open source!
Please review the LICENSE.md file for license information.
If you have any questions or concerns on licensing, please contact [email protected].
Distributed as-is; no warranty is given.
- Your friends at SparkFun.