Finished project.

Dependencies:   X_NUCLEO_COMMON

Fork of ReferredCoursework2016 by Stage-1 Students SoCEM

Revision:
90:38dfa3f350aa
Child:
91:cd9fcd45ecf6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensor.cpp	Thu Aug 17 02:42:30 2017 +0000
@@ -0,0 +1,32 @@
+/*sensor.cpp simply reads in the acceleration measurements
+using the NUCLEO board and using the function and struct
+from buffer.cpp, stores the values in to the circular buffer*/
+#include "mbed.h"
+#include "x_nucleo_iks01a1.h"
+#include "buffer.h"
+#include "sensor.h"
+
+/* Instantiate the expansion board */
+static X_NUCLEO_IKS01A1 *mems_expansion_board = X_NUCLEO_IKS01A1::Instance(D14, D15);
+
+/* Retrieve the composing elements of the expansion board */
+static MotionSensor *accelerometer = mems_expansion_board->GetAccelerometer();
+
+extern char *printDouble(char* str, double v, int decimalDigits = 2);
+
+int32_t axes[3];
+
+void sensor_run(){
+     while (1) {
+   
+    accelerometer->Get_X_Axes(axes);
+
+    AccelData d;
+    d.x = axes[0];
+    d.y = axes[1];
+    d.z = axes[2];  
+    
+    log_push(d);
+    }
+
+}
\ No newline at end of file