A data logger for the FRDM-K64F taking readings from the FXOS8700CQ accelerometer/magnometer at 200Hz.

Dependencies:   FXOS8700CQ SDFileSystem mbed

Fork of Hello_FXOS8700Q by Jim Carver

Files at this revision

API Documentation at this revision

Comitter:
JimCarver
Date:
Thu Apr 24 16:31:17 2014 +0000
Parent:
4:4b494ca218ff
Child:
6:02bfeec82bc1
Commit message:
Temporary Version

Changed in this revision

FXOS8700Q.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/FXOS8700Q.lib	Wed Apr 23 17:12:21 2014 +0000
+++ b/FXOS8700Q.lib	Thu Apr 24 16:31:17 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/JimCarver/code/FXOS8700Q/#c4176a12f7d5
+http://mbed.org/users/JimCarver/code/FXOS8700Q/#cdc362f08339
--- a/main.cpp	Wed Apr 23 17:12:21 2014 +0000
+++ b/main.cpp	Thu Apr 24 16:31:17 2014 +0000
@@ -8,8 +8,11 @@
 
 Serial pc(USBTX, USBRX);
 
-MotionSensorDataUnits mag;
-MotionSensorDataUnits acc;
+MotionSensorDataUnits mag_data;
+MotionSensorDataUnits acc_data;
+
+MotionSensorDataCounts mag_raw;
+MotionSensorDataCounts acc_raw;
 
 /*
 int main(void) {
@@ -22,13 +25,13 @@
         if(sensor.dataReady())
         {
             SensorDataUnits formatted_data;            
-            sensor.getAxis(formatted_data);
+            sensor.getAxis(&formatted_data);
             printf(asdfadsf);
         }
         if(sensor.dataReady())
         {
             SensorDataCounts raw_data;            
-            sensor.getAxis(formatted_data);
+            sensor.getAxis(&raw_data);
             printf(asdfasdf);
         }
         if(sensor.dataReady())
@@ -48,14 +51,14 @@
 
 
 int main() {
-float acc_data[3], mag_data[3];
 
-printf("\r\n\nFXOS8700Q Who Am I= %X\r\n", combo.getWhoAmI());
+acc.enable();
+printf("\r\n\nFXOS8700Q Who Am I= %X\r\n", acc.whoAmI());
     while (true) {
-        combo.getAxis(acc);
-        combo.getAxis(mag);
-        printf("FXOS8700Q ACC: X=%1.4f Y=%1.4f Z=%1.4f  ", acc_data[0], acc_data[1], acc_data[2]);
-        printf("    MAG: X=%4.1f Y=%4.1f Z=%4.1f\r\n\n", mag_data[0], mag_data[1], mag_data[2]);
+        acc.getAxis(acc_data);
+        mag.getAxis(mag_data);
+        printf("FXOS8700Q ACC: X=%1.4f Y=%1.4f Z=%1.4f  ", acc_data.x, acc_data.y, acc_data.z);
+        printf("    MAG: X=%4.1f Y=%4.1f Z=%4.1f\r\n\n", mag_data.x, mag_data.y, mag_data.z);
         wait(1.0);
     }
 }
\ No newline at end of file