--------------------------------------------------------------------
(1)內插公式
(2)存檔、讀檔
(3)利用Timer自動內插
(4)鍵盤+滑鼠
--------------------------------------------------------------------
用Excel
內插公式=A2*90000+(1-A2)*30000
angle=alpha*new_angle+(1-alpha)*old_angle

--------------------------------------------------------------------
(1)加入內插公式的函式到HW裡
(2)準備好Timer函式
--------------------------------------------------------------------
寫檔案
#include <stdio.h>
FILE * fout = NULL;//檔案指標
void keyboard(unsigned char key, int x, int y)
{
printf("%c\n",key);
if(key=='0') now=0;
if(key=='1') now=1;
if(key=='2') now=2;
if(key=='3') now=3;
if(key=='4') now=4;
if(key=='5') now=5;
if(key=='s'||key=='S'){
if(fout == NULL){
fout = fopen("file.txt","w+");
printf("現在我產生一個file.txt的檔案在目錄裡面哦\n");
}
fprintf(fout,"%.3f %.3f %.3f %.3f %.3f\n",
angle[0],angle[1],angle[2],angle[3],angle[4]);
printf("現在我把一些數字印到檔案裡面%.3f %.3f %.3f %.3f %.3f\n",
angle[0],angle[1],angle[2],angle[3],angle[4]);
}
}
沒有留言:
張貼留言