plot accelerometer data
Dependencies: mbed LSM9DS1_Library_cal
Revision 3:201ee5790c15, committed 2020-07-08
- Comitter:
- chebbi
- Date:
- Wed Jul 08 11:06:21 2020 +0000
- Parent:
- 2:e33aed52dc0d
- Commit message:
- send acclerometer and gyro and magnetometer data
Changed in this revision
diff -r e33aed52dc0d -r 201ee5790c15 LSM9DS1_Library_cal.lib --- a/LSM9DS1_Library_cal.lib Thu Jun 25 10:38:41 2020 +0000 +++ b/LSM9DS1_Library_cal.lib Wed Jul 08 11:06:21 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/chebbi/code/LSM9DS1_Library_cal/#0396042de602 +https://os.mbed.com/users/chebbi/code/LSM9DS1_Library_cal/#dd17a2229b9c
diff -r e33aed52dc0d -r 201ee5790c15 main.cpp --- a/main.cpp Thu Jun 25 10:38:41 2020 +0000 +++ b/main.cpp Wed Jul 08 11:06:21 2020 +0000 @@ -20,15 +20,48 @@ if (!IMU.begin()) { pc.printf("Failed to communicate with LSM9DS1.\n"); } - + int i=0 ; while(1) { while(!IMU.accelAvailable()); IMU.readAccel(); - float acc = sqrt(IMU.calcAccel(IMU.ax)*IMU.calcAccel(IMU.ax)+IMU.calcAccel(IMU.ay)*IMU.calcAccel(IMU.ay)+IMU.calcAccel(IMU.az)*IMU.calcAccel(IMU.az)); + + while( !IMU.gyroAvailable() ) + + IMU.readGyro(); + + + //float acc = sqrt(IMU.calcAccel(IMU.ax)*IMU.calcAccel(IMU.ax)+IMU.calcAccel(IMU.ay)*IMU.calcAccel(IMU.ay)+IMU.calcAccel(IMU.az)*IMU.calcAccel(IMU.az)); + + //pc.printf("%9f",acc) ; + pc.printf("%d",i) ; - pc.printf("%9f\n",acc) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.ax)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.ay)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.az)) ; + pc.printf(",") ; + + + pc.printf("%9f",IMU.calcAccel(IMU.gx)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.gy)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.gz)) ; + pc.printf(",") ; + + + pc.printf("%9f",IMU.calcAccel(IMU.mx)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.my)) ; + pc.printf(",") ; + pc.printf("%9f",IMU.calcAccel(IMU.mz)) ; + pc.printf("%\n\r") ; + + i++ ; wait(0.1) ;
diff -r e33aed52dc0d -r 201ee5790c15 mbed-os.lib --- a/mbed-os.lib Thu Jun 25 10:38:41 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://github.com/armmbed/mbed-os/#e4b81f67f939a0c0b11c147ce74aa367271e1279
diff -r e33aed52dc0d -r 201ee5790c15 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 08 11:06:21 2020 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file