/*L1b - program lectura si afisare temperatura procesor Compilare: >gcc -o l1b l1b.c Lansare in executie: rpi>./l1b */ #include #include // defineste sleep() int main(void) { FILE *thermal; float cputemp,t; int i,j; //for (j=1;j<10;j++) while(1) { thermal=fopen("/sys/class/thermal/thermal_zone0/temp","r"); i=fscanf(thermal,"%f",&t);// returneaza miligrade fclose(thermal); cputemp=t/1000; printf("Temperatura CPU este de %2.3f grade C\n",cputemp); sleep(1); } return 0; }