CECS 447 Team Pair (Loc/Ivan)
/
AccelerometertestLPC4088
This program reads the MMA7455 Accelerometer unit on the LPC4088 Base Board and outputs to UART
Diff: main.cpp
- Revision:
- 0:52dfb5e3ed6f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 13 00:33:19 2015 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "MMA7455.h" + +MMA7455 sens(P0_27,P0_28); +Serial pc(USBTX, USBRX); + +int main() +{ + pc.baud(19200); + int x,y,z;//val[3] = [0,0,0]; + pc.printf("[X, Y, Z] = \n\r"); + + while(!sens.setMode(MMA7455::ModeMeasurement)); //Setting mode : Measurement + while(!sens.calibrate()); //Calibrating axis + + while(1) + { + sens.read(x, y, z); + pc.printf("[%d.1, %d.1, %d.1]\r", x, y, z); + wait(2); + } +} \ No newline at end of file