acelerometro de la FL25Z
Dependencies: MMA8451Q TextLCD-modificada mbed
Revision 0:d46386356b10, committed 2013-12-05
- Comitter:
- salondonog
- Date:
- Thu Dec 05 21:10:10 2013 +0000
- Commit message:
- acelerometro de la FL25Z
Changed in this revision
diff -r 000000000000 -r d46386356b10 MMA8451Q.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Thu Dec 05 21:10:10 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
diff -r 000000000000 -r d46386356b10 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Dec 05 21:10:10 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/salondonog/code/TextLCD-modificada/#74616aa6c0c7
diff -r 000000000000 -r d46386356b10 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 05 21:10:10 2013 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "MMA8451Q.h" +#include "TextLCD.h" +#define MMA8451_I2C_ADDRESS (0x1d<<1) + +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); //configura los puestos PTE0,PTE1,PTE2,PTE3,PTE4,PTE5, donde se conectara el LCD 16x2 +MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); +PwmOut rojo(LED_RED); +PwmOut verde(LED_GREEN); +PwmOut azul(LED_BLUE); + +float X,Y,Z; + +void imprimir(void){ //funcion que imprime los caracteres que no van a variar en el display +lcd.cls(); +lcd.locate(0,0); +lcd.printf("X=%.3f",X); +lcd.locate(8,0); +lcd.printf("Y=%.3f",Y); +lcd.locate(0,1); +lcd.printf("Z=%.3f",Z); +} + + +int main() { + while(1) { + X=acc.getAccX(); + Y=acc.getAccY(); + Z=acc.getAccZ(); + imprimir(); + rojo=1.0 - abs(X); + verde=1.0 - abs(Y); + azul=1.0 - abs(Z); + wait(0.1); + } +}
diff -r 000000000000 -r d46386356b10 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 05 21:10:10 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file