Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LSM9DS1_Library by
main.cpp
00001 #include "LSM9DS1.h" 00002 #include <vector> 00003 using std::vector; 00004 00005 DigitalOut myled(LED1); 00006 Serial pc(USBTX, USBRX); 00007 00008 int main() { 00009 //LSM9DS1 lol(D14, D15, 0x6B, 0x1E); 00010 LSM9DS1 lol(D14, D15, 0xD6, 0x3C); 00011 00012 vector<float> gyro(3, 0.0); 00013 vector<float> accel(3, 0.0); 00014 00015 lol.begin(); 00016 if (!lol.begin()) { 00017 pc.printf("Failed to communicate with LSM9DS1.\n"); 00018 } 00019 lol.calibrate(); 00020 00021 while(1) { 00022 00023 lol.readGyroFloatVectorDeg(gyro); 00024 lol.readAccelFloatVector(accel); 00025 00026 00027 pc.printf("gyro: %.3f %.3f %.3f\n\r", gyro[X_AXIS], gyro[Y_AXIS], gyro[Z_AXIS]); 00028 //pc.printf("accel: %f %f %f\n\n\r", accel[X_AXIS], accel[Y_AXIS], accel[Z_AXIS]); 00029 00030 } 00031 }
Generated on Sat Jul 16 2022 23:28:27 by
1.7.2
