Accelerazione MEMS
Dependencies: X_NUCLEO_IKS01A2 mbed
Fork of HelloWorld_IKS01A2 by
Revision 16:d099819b1113, committed 2017-06-16
- Comitter:
- franc_unina
- Date:
- Fri Jun 16 09:10:11 2017 +0000
- Parent:
- 15:e62c17d917a5
- Commit message:
- Acc
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e62c17d917a5 -r d099819b1113 main.cpp --- a/main.cpp Tue Mar 14 15:23:19 2017 +0000 +++ b/main.cpp Fri Jun 16 09:10:11 2017 +0000 @@ -92,6 +92,9 @@ float value1, value2; char buffer1[32], buffer2[32]; int32_t axes[3]; + int16_t Myaxes_int[3]; + float sensitivity; + float Myaxes[3]; /* Enable all sensors */ hum_temp->enable(); @@ -116,7 +119,7 @@ while(1) { printf("\r\n"); - + /* hum_temp->get_temperature(&value1); hum_temp->get_humidity(&value2); printf("HTS221: [temp] %7s C, [hum] %s%%\r\n", print_double(buffer1, value1), print_double(buffer2, value2)); @@ -129,16 +132,25 @@ magnetometer->get_m_axes(axes); printf("LSM303AGR [mag/mgauss]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); - + accelerometer->get_x_axes(axes); + printf("LSM303AGR [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); - + */ acc_gyro->get_x_axes(axes); printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); + acc_gyro->get_x_axes_raw(Myaxes_int); + acc_gyro->get_x_sensitivity(&sensitivity); + Myaxes[0]=((float)(Myaxes_int[0]))*sensitivity; + Myaxes[1]=((float)(Myaxes_int[1]))*sensitivity; + Myaxes[2]=((float)(Myaxes_int[2]))*sensitivity; + printf("Sensitivity : %f\r\n", sensitivity); + printf("LSM6DSL [acc/mg]: %f, %f, %f\r\n,", Myaxes[0], Myaxes[1], Myaxes[2]); + /* acc_gyro->get_g_axes(axes); printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); - + */ wait(1.5); } }