Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IKS01A2 mbed
Fork of AccpiuGiroscopio_timer by
Revision 15:25999e71b22d, committed 2017-02-11
- Comitter:
- vidica94
- Date:
- Sat Feb 11 15:18:54 2017 +0000
- Parent:
- 14:de30b189c5ec
- Child:
- 16:553a1c68d606
- Commit message:
- funziona abbastanza bene ora
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Feb 10 18:52:39 2017 +0000
+++ b/main.cpp Sat Feb 11 15:18:54 2017 +0000
@@ -36,13 +36,14 @@
wait(1.5);
acc_gyro->Get_G_Axes(axes);
printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
- for(int i=0;i<3;i++){
+ for(int i=0;i<3;i++){
off[i]=axes[i];}
printf("off [gyro/mdps]: %6ld, %6ld, %6ld\r\n", off[0], off[1], off[2]);
while(1) {
printf("\r\n");
acc_gyro->Get_X_Axes(axes);
+
printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
acc_gyro->Get_G_Axes(axes);
@@ -51,20 +52,24 @@
{axes[i]=axes[i]-off[i];}
printf("LSM6DSLfine [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
k=k+1;
- wait_m(1);
+ wait_ms(1);
- // ricavo l'parziale dalla velocità angolare
+ // ricavo il parziale dalla velocità angolare
for(int i=0;i<3;i++)
{
- parziale[i]=(axes[i]*sens)/1000;
+ parziale[i]=(axes[i]*sens)/1000;// passo da mdps a dpLSB
+
+finale[i]=(finale[i]-19)/2.84;// levo la correzione per poter sommare i dati parziali
+ parziale[i]/= 1000;// moltiplico per il dt (1ms)
+ if (axes[i]>150 ||axes[i]<-150)
+ finale[i] += parziale[i]; // integro
+
+ finale[i]=(finale[i]*2.84)+19;// correggo offset e guadagno che ho ricavato da una "taratura" grezza (ricavo la retta )
+
+}
- parziale[i]/= 1000;
- if (axes[i]>150 ||axes[i]<-150)
- finale[i] += parziale[i];
-
-}
printf("finale [gyro/d]: %6f, %6f, %6f\r\n", finale[0], finale[1], finale[2]);//angolo
}
}
