Acelerometro
Dependencies: MMA8451Q TextLCD mbed
Revision 0:89e2fbe7492b, committed 2013-12-12
- Comitter:
- leorestrepo93
- Date:
- Thu Dec 12 13:45:24 2013 +0000
- Commit message:
- Acelerometro
Changed in this revision
diff -r 000000000000 -r 89e2fbe7492b MMA8451Q.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Thu Dec 12 13:45:24 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
diff -r 000000000000 -r 89e2fbe7492b TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Dec 12 13:45:24 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/leorestrepo93/code/TextLCD/#0eeeb2e18fb4
diff -r 000000000000 -r 89e2fbe7492b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 12 13:45:24 2013 +0000 @@ -0,0 +1,47 @@ +#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(3,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(5,1); + lcd.printf(" "); + lcd.locate(5,1); + lcd.printf("%.2f",sensor_data[1]); + wait(1); + + } + + +} \ No newline at end of file
diff -r 000000000000 -r 89e2fbe7492b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 12 13:45:24 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file