IMU LSM9DS1 Library (fixed)
Fork of LSM9DS1_Library by
Revision 5:8da857db15e0, committed 2017-08-03
- Comitter:
- cduck
- Date:
- Thu Aug 03 15:50:09 2017 -0700
- Parent:
- 4:1345050179ad
- Commit message:
- Rename main.cpp so it isn't compiled as part of the library
Changed in this revision
main.cpp | Show diff for this revision Revisions of this file |
main.cpp.example | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1345050179ad -r 8da857db15e0 main.cpp --- a/main.cpp Thu Aug 03 15:41:27 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#include "LSM9DS1.h" - -DigitalOut myled(LED1); -Serial pc(USBTX, USBRX); - -int main() { - //LSM9DS1 lol(p9, p10, 0x6B, 0x1E); - LSM9DS1 lol(p9, p10, 0xD6, 0x3C); - lol.begin(); - if (!lol.begin()) { - pc.printf("Failed to communicate with LSM9DS1.\n"); - } - lol.calibrate(); - while(1) { - lol.readTemp(); - lol.readMag(); - lol.readGyro(); - - //pc.printf("%d %d %d %d %d %d %d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz), lol.ax, lol.ay, lol.az, lol.mx, lol.my, lol.mz); - //pc.printf("%d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz)); - pc.printf("gyro: %d %d %d\n\r", lol.gx, lol.gy, lol.gz); - pc.printf("accel: %d %d %d\n\r", lol.ax, lol.ay, lol.az); - pc.printf("mag: %d %d %d\n\n\r", lol.mx, lol.my, lol.mz); - myled = 1; - wait(2); - myled = 0; - wait(2); - } -}
diff -r 1345050179ad -r 8da857db15e0 main.cpp.example --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp.example Thu Aug 03 15:50:09 2017 -0700 @@ -0,0 +1,29 @@ +#include "LSM9DS1.h" + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); + +int main() { + //LSM9DS1 lol(p9, p10, 0x6B, 0x1E); + LSM9DS1 lol(p9, p10, 0xD6, 0x3C); + lol.begin(); + if (!lol.begin()) { + pc.printf("Failed to communicate with LSM9DS1.\n"); + } + lol.calibrate(); + while(1) { + lol.readTemp(); + lol.readMag(); + lol.readGyro(); + + //pc.printf("%d %d %d %d %d %d %d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz), lol.ax, lol.ay, lol.az, lol.mx, lol.my, lol.mz); + //pc.printf("%d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz)); + pc.printf("gyro: %d %d %d\n\r", lol.gx, lol.gy, lol.gz); + pc.printf("accel: %d %d %d\n\r", lol.ax, lol.ay, lol.az); + pc.printf("mag: %d %d %d\n\n\r", lol.mx, lol.my, lol.mz); + myled = 1; + wait(2); + myled = 0; + wait(2); + } +}