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

Files at this revision

API Documentation at this revision

Comitter:
caaruizze
Date:
Sat Dec 07 13:07:58 2013 +0000
Parent:
5:2d14600116fc
Commit message:
Programa para visualizar la posici?n de la tarjeta KL25Z en un lcd 16x2 por medio del acelerometro que trae incorporado

Changed in this revision

TextLCD.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
diff -r 2d14600116fc -r dc999681de1a TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sat Dec 07 13:07:58 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/caaruizze/code/TextLCD3libreriatexlcd/#e5aab3918869
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
diff -r 2d14600116fc -r dc999681de1a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 07 13:07:58 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file