David Rodríguez
/
proy_final_automatica3
proyecto final de automatica 3
Diff: main.cpp
- Revision:
- 0:7e3fcb3252ec
diff -r 000000000000 -r 7e3fcb3252ec main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 22 17:03:36 2014 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +#include "MMA8451Q.h" + +#define MMA8451_I2C_ADDRESS (0x1d<<1) + +AnalogIn sensor1(PTB0); +Serial pc(USBTX, USBRX); + + +int presion; +float posx,posy,posz; + +int main() { + + + MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); + + while(1) { + + //presion = sensor1.read_u16(); + posx=abs(acc.getAccX()); + posy=abs(acc.getAccY()); + posz=abs(acc.getAccZ()); + + pc.printf("%f%f%f@",posx,posy,posz); + pc.printf(""); + wait(0.5); + + } +}