AdvRobot_Team / Mbed 2 deprecated LSM9DS1_SPI

Dependencies:   LSM9DS1_ADVRO mbed

Files at this revision

API Documentation at this revision

Comitter:
ChangYuHsuan
Date:
Wed Jun 21 09:07:13 2017 +0000
Parent:
0:a78e30188b92
Commit message:
LSM9DS1 SPI ver 1.01;

Changed in this revision

LSM9DS1.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/LSM9DS1.lib	Wed Jun 21 07:14:46 2017 +0000
+++ b/LSM9DS1.lib	Wed Jun 21 09:07:13 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/AdvRobot_Team/code/LSM9DS1_ADVRO/#50166e25abb5
+https://developer.mbed.org/teams/AdvRobot_Team/code/LSM9DS1_ADVRO/#c2804ae02c80
--- a/main.cpp	Wed Jun 21 07:14:46 2017 +0000
+++ b/main.cpp	Wed Jun 21 09:07:13 2017 +0000
@@ -14,29 +14,25 @@
 DigitalOut mCS(PA_14);
 LSM9DS1 imu(&imuSpi, &agCS, &mCS, 0xD6, 0x3C);
 
-float dpsZ = 0.0f, degree = 0.0f;
+float degree = 0.0f;
 
 int main() {
         
     pc.baud(115200);
     
+    pc.printf("Start LSM9DS1\n\r");
+        
     bool status = imu.begin();
     pc.printf("connect or not: %d\n\r", status);
-   
+    
     imu.calibrate();
+    wait(1);    
     
     timer1.attach_us(&timerInterrupt, PERIOD);
     
     while(1) {
         
-        /*myled = 1;
-        imu.readGyro();
-        
-        dpsZ = imu.calcGyro(imu.gz);
-        degree += dpsZ * 0.01f;
-        myled = 0;*/
-        
-        pc.printf("gryo z: %.3f degree: %.3f \n\r", dpsZ, degree);
+        pc.printf("gz: %.3f  gzBias: %.3f  degree: %.3f \n\r", imu.gz, imu.gBias[2], degree);
                
         wait(0.01);
     }
@@ -46,6 +42,5 @@
 {
     imu.readGyro();
         
-    dpsZ = imu.calcGyro(imu.gz);
-    degree += dpsZ * PERIOD / 1000000.0f;
-}
+    degree += imu.gz * PERIOD / 1000000.0f;
+}
\ No newline at end of file