Accel
Dependencies: mbed PowerControl SDFileSystem
Fork of HeptaAccel by
Diff: main.cpp
- Revision:
- 0:d721efd58e4e
- Child:
- 1:63c3921c608c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 09 03:40:15 2016 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "HeptaAccel.h" + +Serial pc(USBTX,USBRX); +HeptaAccel accel(p28,p27,0x38); + +int main(){ + pc.baud(9600); + float ax2,ay2,az2; + char ax[4],ay[4],az[4]; + int dsize; + while(1){ + pc.printf("Accel Sensor Mode\r\n"); + for(int i=0;i<10;i++){ + accel.sensing_u16(ax,ay,az,&dsize); + accel.sensing(&ax2,&ay2,&az2); + pc.printf("%c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c\r\n",ax[0],ax[1],ax[2],ax[3],ay[0],ay[1],ay[2],ay[3], + az[0],az[1],az[2],az[3]); + pc.printf("%f %f %f\r\n",ax2,ay2,az2); + wait(1.0); + } + } +} \ No newline at end of file