Modified LSM9DS1 Demo

Dependencies:   LSM9DS1 mbed

Fork of LSM9DS1_Demo by Eugene Gonzalez

Files at this revision

API Documentation at this revision

Comitter:
5hel2l2y
Date:
Fri Jun 17 21:14:10 2016 +0000
Parent:
0:9632b831b6c1
Commit message:
Modified LSM9DS1 Demo

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 9632b831b6c1 -r 0d392105900f LSM9DS1.lib
--- a/LSM9DS1.lib	Mon Oct 19 16:52:59 2015 +0000
+++ b/LSM9DS1.lib	Fri Jun 17 21:14:10 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/beanmachine44/code/LSM9DS1/#0e76f237c23d
+https://developer.mbed.org/users/5hel2l2y/code/LSM9DS1/#ac3b69ccd3dd
diff -r 9632b831b6c1 -r 0d392105900f main.cpp
--- a/main.cpp	Mon Oct 19 16:52:59 2015 +0000
+++ b/main.cpp	Fri Jun 17 21:14:10 2016 +0000
@@ -7,16 +7,25 @@
 #define REFRESH_TIME_MS 1000
 
 // Verify that the pin assignments below match your breadboard
-LSM9DS1 imu(p9, p10);
+LSM9DS1 imu(p30, p7);
 
-Serial pc(USBTX, USBRX);
+Serial pc(p9, p11);
 
 //Init Serial port and LSM9DS1 chip
 void setup()
 {
     // Use the begin() function to initialize the LSM9DS0 library.
     // You can either call it with no parameters (the easy way):
-    uint16_t status = imu.begin();
+    // SLEEP
+    //uint16_t status = imu.begin(imu.G_SCALE_245DPS, imu.A_SCALE_2G, imu.M_SCALE_4GS,
+//                                imu.G_POWER_DOWN, imu.A_POWER_DOWN, imu.M_ODR_0625);
+    // LOWEST
+    //uint16_t status = imu.begin(imu.G_SCALE_245DPS, imu.A_SCALE_2G, imu.M_SCALE_4GS,
+//                                imu.G_ODR_15_BW_0, imu.A_POWER_DOWN, imu.M_ODR_0625);
+    // HIGHEST
+    uint16_t status = imu.begin(imu.G_SCALE_2000DPS, imu.A_SCALE_8G, imu.M_SCALE_16GS,
+                                imu.G_ODR_952_BW_100, imu.A_ODR_952, imu.M_ODR_80);
+        
 
     //Make sure communication is working
     pc.printf("LSM9DS1 WHO_AM_I's returned: 0x%X\r\n", status);
@@ -30,18 +39,28 @@
 
     while (true)
     {
+        imu.readTemp();
+        pc.printf("Temp:\r\n");
+        pc.printf("TC: %2f\r\n", imu.temperature_c);
+        pc.printf("TF: %2f\r\n", imu.temperature_f);
         
         imu.readAccel();
-    
-        pc.printf("A: %2f, %2f, %2f\r\n", imu.ax, imu.ay, imu.az);
+        pc.printf("Accel:\r\n");
+        pc.printf("AX: %2f\r\n", imu.ax);
+        pc.printf("AY: %2f\r\n", imu.ay);
+        pc.printf("AZ: %2f\r\n", imu.az);
 
         imu.readGyro();
+        pc.printf("Gyro:\r\n");
+        pc.printf("GX: %2f\r\n", imu.gx);
+        pc.printf("GY: %2f\r\n", imu.gy);
+        pc.printf("GZ: %2f\r\n", imu.gz);
         
-        pc.printf("G: %2f, %2f, %2f\r\n", imu.gx, imu.gy, imu.gz);
-
         imu.readMag();
-        
-        pc.printf("M: %2f, %2f, %2f\r\n\r\n", imu.mx, imu.my, imu.mz);
+        pc.printf("Mag:\r\n");
+        pc.printf("MX: %2f\r\n", imu.mx);
+        pc.printf("MY: %2f\r\n", imu.my);
+        pc.printf("MZ: %2f\r\n\r\n", imu.mz);
        
         wait_ms(REFRESH_TIME_MS);
     }
diff -r 9632b831b6c1 -r 0d392105900f mbed.bld
--- a/mbed.bld	Mon Oct 19 16:52:59 2015 +0000
+++ b/mbed.bld	Fri Jun 17 21:14:10 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file