![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This program reads the MMA7455 Accelerometer unit on the LPC4088 Base Board and outputs to UART
main.cpp
- Committer:
- lhinh3431
- Date:
- 2015-10-13
- Revision:
- 0:52dfb5e3ed6f
File content as of revision 0:52dfb5e3ed6f:
#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); } }