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.
calibrate.cpp
00001 #include "header.h" 00002 00003 extern float Xcal; 00004 extern float Ycal; 00005 extern float Zcal; 00006 extern int i; 00007 extern float per_old; 00008 extern float per_new; 00009 extern float sumx; 00010 extern float sumy; 00011 extern float sumz; 00012 extern float Xoff; 00013 extern float Yoff; 00014 extern float Zoff; 00015 00016 void calibrate(void){ 00017 while (1){ 00018 lcd.locate(1,11); lcd.printf("Press Select to Confirm"); 00019 00020 sumx=0; 00021 sumy=0; 00022 sumz=0; 00023 00024 for(i=0; i<199; i++) { 00025 Xcal=((Xcal)*(per_old))+((acc.x())*(per_new)); 00026 Ycal=((Ycal)*(per_old))+((acc.y())*(per_new)); 00027 Zcal=((Zcal)*(per_old))+((acc.z())*(per_new)); 00028 lcd.locate(1,9); lcd.printf("Calibrate"); lcd.printf("%i",(200-i)); 00029 sumx += Xcal; 00030 sumy += Ycal; 00031 sumz += Zcal; 00032 00033 } 00034 Xoff=0-(sumx/200); 00035 Yoff=0-(sumy/200); 00036 Zoff=1-(sumz/200); 00037 00038 lcd.locate(1,1); lcd.printf("X="); lcd.printf("%0.5f",Xoff); 00039 lcd.locate(1,3); lcd.printf("Y="); lcd.printf("%0.5f",Yoff); 00040 lcd.locate(1,5); lcd.printf("Z="); lcd.printf("%0.5f",Zoff); 00041 00042 but2.fall(&menuscreen); 00043 } 00044 00045 }
Generated on Mon Aug 8 2022 08:50:07 by
1.7.2