IBS
/
LAB20_Accelorometer
Day 5 starts Accelometer values are plotted in serial plotter.
Revision 0:b8dd451716ae, committed 2016-07-02
- Comitter:
- akashlal
- Date:
- Sat Jul 02 05:33:40 2016 +0000
- Commit message:
- NA
Changed in this revision
diff -r 000000000000 -r b8dd451716ae MMA8451Q.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Sat Jul 02 05:33:40 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
diff -r 000000000000 -r b8dd451716ae main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jul 02 05:33:40 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "MMA8451Q.h" +#define MMA8451_I2C_ADDRESS (0x1d<<1) +Serial pc(USBTX, USBRX); +MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); + +int main() { + int xvali, yvali, zvali; + while(1) { + xvali = (acc.getAccX()+2)*100; + yvali = (acc.getAccY()+2)*100; + zvali = (acc.getAccZ()+2)*100; + pc.printf("$%d %d %d;",xvali,yvali,zvali); + wait(0.2); + } +}
diff -r 000000000000 -r b8dd451716ae mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jul 02 05:33:40 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file