Dependencies:   mbed MMA8451Q

Files at this revision

API Documentation at this revision

Comitter:
contechno
Date:
Wed Oct 09 17:19:36 2019 +0000
Commit message:
UNAL_Procesadores; Actividad 3

Changed in this revision

MMA8451Q.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/MMA8451Q.lib	Wed Oct 09 17:19:36 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 09 17:19:36 2019 +0000
@@ -0,0 +1,19 @@
+// UNAL - Procesadores
+// Actividades Oct/2019 - JMP
+
+#include "mbed.h"
+#include "MMA8451Q.h" // Acc-Sensor
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+#define POLLTIME 0.1 // Time in ms, how often the Acc-Sensor is read out
+
+Serial pc(USBTX, USBRX); // Init serial
+
+int main() {
+    MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+    
+    while(1) {
+        pc.printf("(X|Y|Z) - (%.2f|%.2f|%.2f)\r\n",abs(acc.getAccX()),abs(acc.getAccY()),abs(acc.getAccZ()));
+        wait(POLLTIME);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 09 17:19:36 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file