Пример #1
1
void * writeData() {
	for (;;) {
		if (rep > 0) {
			float newTemp = tempConverter(mraa_aio_read(tempSensor));
			if (scale == 'F')
				newTemp = 32 + (1.8*newTemp);
			char tarr[20];
			convertTime(tarr);
			if (log_flag && logOpt)
				fprintf(myFile,"%s %.1f\n",tarr,newTemp);
			if (log_flag)
				fprintf(stderr,"%s %.1f\n",tarr,newTemp);
			if (iflag == 0)
				iflag = 1;
			sleep(duration);
		}
	}
	return 0;
}
Пример #2
0
int main(void) {

	double fahr;
	
	// Print the table header
	printf("%2c %5c %6c\n", 'F', 'C', 'K');
	printf("-----------------\n");
	
	// Temperatures in increments of 10 degrees Fahrenheit up to 300
	for(fahr = 0; fahr <= 300; fahr += 10) {
		tempConverter(fahr);
		}

	return 0;
}