View difference between Paste ID: z73fiWHd and 8XxETwuL
SHOW: | | - or go back to the newest paste.
1
#include <wiringPi.h>
2
#include <stdio.h>
3
#include <unistd.h>
4
#define N 2
5-
int main (void)
5+
int main (void) {
6-
{
6+
7
	pinMode(1,OUTPUT);
8
	int temp;
9
	char arr[N];
10
	FILE *file;
11
	while(1) {
12-
	while(1){
12+
		file = fopen("/sys/class/thermal/thermal_zone0/temp" , "r");
13-
		file = fopen("/sys/class/thermal/thermal_zone0/temp","r");
13+
14
		fclose(file);
15
		temp=(arr[0]-'0')*10+arr[1]-'0';
16
		printf("%i\n", temp);
17-
		printf("%i\n",temp);
17+
18
			digitalWrite(1,HIGH);
19
		else
20
			digitalWrite(1,LOW);
21
		delay(10000);
22
	}
23
	return 0;
24
}