Craig Evans / Mbed 2 deprecated 2645_FXOS8700CQ_Library

Dependencies:   FXOS8700CQ mbed

Files at this revision

API Documentation at this revision

Comitter:
eencae
Date:
Tue Jan 31 19:05:19 2017 +0000
Child:
1:62b9d4243e97
Commit message:
Example code for using FXOS8700CQ library.

Changed in this revision

FXOS8700CQ.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700CQ.lib	Tue Jan 31 19:05:19 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/eencae/code/FXOS8700CQ/#f66eda6a492a
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 31 19:05:19 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5
\ No newline at end of file