MicroArm MINI2440 User Manual Page 65

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 64
return ret;
}
Φόρτωση μεταβλητών από conf.txt:
/*Load conf vatiables*/
file = fopen (filename, "r");
if ( file != NULL ){
while ( fgets ( line, sizeof line, file ) != NULL ){ /* read a
line */
if(strncmp(line,"max tempetarure",14) == 0){
value = strchr(line,'\t');
maxt = atoi(value);
}
if(strncmp(line,"max humidity",12) == 0){
value = strchr(line,'\t');
maxh = atoi(value);
}
if(strncmp(line,"min temperature",13) == 0){
value = strchr(line,'\t');
mint = atoi(value);
}
if(strncmp(line,"min humitity",11) == 0){
value = strchr(line,'\t');
minh = atoi(value);
}
if(strncmp(line,"LED1",4) == 0){
value = strchr(line,'\t');
led1mod = atoi(value);
}
if(strncmp(line,"LED2",4) == 0){
value = strchr(line,'\t');
led2mod = atoi(value);
}
i++;
}
fclose (file);
}
else{
perror (filename); /* why didn't the file open? */
}
/*Telos Load conf vatiables*/
Αποθήκευση δεδομένων στο conf.txt:
/*write to file*/
fprintf(file,"max tempetarure\t%d\n",maxt);
fprintf(file,"max humidity\t%d\n",maxh);
fprintf(file,"min temperature\t%d\n",mint);
fprintf(file,"min humitity\t%d\n",minh);
fprintf(file,"LED1\t%d\n",led1mod);
fprintf(file,"LED2\t%d\n",led2mod);
Αποθήκευση μετρήσεων στη βάση δεδομένων:
Χρησιμοποιείται στο πρόγραμμα envstored.
Σελίδα 58
Page view 64
1 2 ... 60 61 62 63 64 65 66 67 68 69 70 ... 79 80

Comments to this Manuals

No comments