Actividad_3

Dependencies:   mbed TSI MMA8451Q

Files at this revision

API Documentation at this revision

Comitter:
sergio_restrepo
Date:
Thu Oct 17 03:14:21 2019 +0000
Commit message:
Actividad_3

Changed in this revision

MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
TSI.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	Thu Oct 17 03:14:21 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/TSI.lib	Thu Oct 17 03:14:21 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/emilmont/code/TSI/#507b1f67804b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 17 03:14:21 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+Serial pc(USBTX, USBRX);
+float X, Y, Z;
+int main() {
+    MMA8451Q acc(PTE25,PTE24,MMA8451_I2C_ADDRESS);
+    PwmOut rled(LED1);
+    PwmOut gled(LED2);
+    PwmOut bled(LED3);
+    
+    while(true) {
+        X=abs(acc.getAccX());
+        Y=abs(acc.getAccY());
+        Z=abs(acc.getAccZ());
+        pc.printf("X=%0.2f\tY=%0.2f\tZ=%0.2f\n",X,Y,Z);
+        rled = 1.0 - X;
+        gled = 1.0 - Y;
+        bled = 1.0 - Z;
+        
+        wait(0.3);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 17 03:14:21 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file