?? log_temp.c
字號:
/* log_temp.c */
/* compile uadc.c with: gcc -c uadc.c */
/* then compile with: gcc -O log_temp.c uadc.o */
/* used in Ordinary user mode */
#include <stdio.h>
#include <stdlib.h>
#include "uadc.h"
int main(int argc, char * argv[]))
{
int data_point;
float temp;
int i;
if (argc < 3)
{
fprintf(stderr,"Usage: argv[0] Number_of_minutes output_file\n");
return -1;
}
if(adc(CHANNEL_3,DEVICE_OPEN))
{
outfile=fopen(argv[2],"w");
for (i=0;i<atoi(argv[1]);i++)
{
data_point=adc(CHANNEL_3,DEVICE_READ);
temp=(float)(data_point-2730)/10.0;
fprintf(outfile,"%d %f \n",i,temp);
sleep(60);
}
adc(CHANNEL_3,DEVICE_CLOSE);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -