This repository has been archived by the owner on Oct 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
microbuilder
committed
Oct 11, 2016
1 parent
421141d
commit 3adbf0e
Showing
5 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// This file is provided for compatibility reasons with the deprecated | ||
// (non-Unified) Adafruit_LSM303 library. Any new development should use | ||
// the Adafruit_LSM303_U.h header, this file is provided to try to minimize | ||
// issues with projects that depend on the older driver. | ||
|
||
#ifndef __ADAFRUIT_LSM303_H__ | ||
#define __ADAFRUIT_LSM303_H__ | ||
|
||
#include "Adafruit_LSM303_U.h" | ||
|
||
#endif // __ADAFRUIT_LSM303_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <Wire.h> | ||
#include <Adafruit_Sensor.h> | ||
#include <Adafruit_LSM303.h> | ||
|
||
Adafruit_LSM303 lsm; | ||
|
||
void setup() | ||
{ | ||
#ifndef ESP8266 | ||
while (!Serial); // will pause Zero, Leonardo, etc until serial console opens | ||
#endif | ||
Serial.begin(9600); | ||
|
||
// Try to initialise and warn if we couldn't detect the chip | ||
if (!lsm.begin()) | ||
{ | ||
Serial.println("Oops ... unable to initialize the LSM303. Check your wiring!"); | ||
while (1); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
lsm.read(); | ||
Serial.print("AX: "); Serial.print((int)lsm.accelData.x); Serial.print(" "); | ||
Serial.print("AY: "); Serial.print((int)lsm.accelData.y); Serial.print(" "); | ||
Serial.print("AZ: "); Serial.print((int)lsm.accelData.z); Serial.print(" "); | ||
Serial.print("MX: "); Serial.print((int)lsm.magData.x); Serial.print(" "); | ||
Serial.print("MY: "); Serial.print((int)lsm.magData.y); Serial.print(" "); | ||
Serial.print("MZ: "); Serial.println((int)lsm.magData.z); Serial.print(" "); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=Adafruit LSM303DLHC | ||
version=1.0.2 | ||
version=1.0.3 | ||
author=Adafruit | ||
maintainer=Adafruit <[email protected]> | ||
sentence=Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer) | ||
|