Example code for FXOS8700CQ library

Dependencies:   FXOS8700CQ mbed

Revision:
0:a2ca34fbe933
Child:
1:62b9d4243e97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 31 19:05:19 2017 +0000
@@ -0,0 +1,33 @@
+/* FXOS8700CQ Library
+
+Sample code from ELEC2645 - demonstrates how to create a library
+for the K64F on-board accelerometer and magnetometer
+
+(c) Craig A. Evans, University of Leeds, Jan 2017
+
+*/ 
+
+#include "mbed.h"
+#include "FXOS8700CQ.h"
+
+// create object and specifiy pins
+FXOS8700CQ device(I2C_SDA,I2C_SCL);
+
+int main()
+{
+    // call initialisation method
+    device.init();
+
+    while (1) {
+        
+        // poll the sensor and get the values, storing in a struct
+        Data values = device.get_values();
+        
+        // print each struct member over serial
+        printf("ax = %f ay = %f az = %f | mx = %f my = %f mz = %f\n"
+               ,values.ax, values.ay, values.az
+               ,values.mx, values.my, values.mz);
+        
+        wait(0.5);
+    }
+}
\ No newline at end of file