programa para ver la posición de la tarjeta por medio del acelerometro que trae incorporado

Dependencies:   TextLCD3libreriatexlcd mbed

Fork of MMA8451Q by Johan Kritzinger

Revision:
6:dc999681de1a
diff -r 2d14600116fc -r dc999681de1a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 07 13:07:58 2013 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+#include "TextLCD.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+TextLCD lcd(PTB10,PTB11,PTE2,PTE3,PTE4,PTE5);
+
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+
+float sensor_data[3];
+
+int main(){
+    lcd.locate(0,0);
+    lcd.printf("Tarea           Acelerometro");
+    wait(2);
+    lcd.cls();
+    lcd.locate(0,0);
+    lcd.printf("X:");
+    lcd.locate(7,0);
+    lcd.printf("Y:");
+    lcd.locate(0,1);
+    lcd.printf("Z:");
+    while(1){
+    
+        acc.getAccAllAxis( &sensor_data[0]);
+        lcd.locate(2,0);
+        lcd.printf("   ");
+        lcd.locate(2,0);
+        lcd.printf("%.2f",sensor_data[2]);
+        lcd.locate(9,0);
+        lcd.printf("   ");
+        lcd.locate(9,0);
+        lcd.printf("%.2f",sensor_data[0]);
+        lcd.locate(3,1);
+        lcd.printf("   ");
+        lcd.locate(3,1);
+        lcd.printf("%.2f",sensor_data[1]);        
+        wait(1);
+        
+    }
+    
+    
+}
\ No newline at end of file