[codeimport processing.serial.*;
Serial serial;
TempCpu cpu;
void setup(){
size(200,200);
cpu=new TempCpu();
serial=new Serial(this,serial.list()[0],9600);
}
void draw(){
if(cpu.retour()>=30&&cpu.retour()<=59){
fill(#006CFF);
noStroke();
rect(0,0,200,200);
fill(#044193);
rect(0,120,200,80);
fill(255,255,255);
rect(25,25,150,150);
stroke(1);
fill(#B2C1C1);
rect(25,25,150,30);
noStroke();
fill(#626C6C);
rect(25,40,150,15);
fill(#F5F3F2);
rect(25,100,150,74);
stroke(1);
fill(#FFFFFF);
textSize(30);
text("CPU TEMP",27,51);
stroke(1);
fill(#0074FF);
textSize(40);
text("C° "+cpu.retour(),45,111);
fill(#CBCBCB);
rect(50,140,100,20);
noStroke();
fill(#6C6C6C);
rect(51,152,99,8);
fill(#11A51B);
rect(51,141,cpu.retour(),19);
fill(#085D0F);
rect(51,152,cpu.retour(),8);
}
if(cpu.retour()>=0&&cpu.retour()<=29){
fill(#006CFF);
noStroke();
rect(0,0,200,200);
fill(#044193);
rect(0,120,200,80);
fill(255,255,255);
rect(25,25,150,150);
stroke(1);
fill(#B2C1C1);
rect(25,25,150,30);
noStroke();
fill(#626C6C);
rect(25,40,150,15);
fill(#F5F3F2);
rect(25,100,150,74);
stroke(1);
fill(#FFFFFF);
textSize(30);
text("CPU TEMP",27,51);
stroke(1);
fill(#0074FF);
textSize(40);
text("C° "+cpu.retour(),45,110);
fill(#CBCBCB);
rect(50,140,100,20);
noStroke();
fill(#6C6C6C);
rect(51,152,99,8);
fill(#0A82FF);
rect(51,141,cpu.retour(),19);
fill(#084E98);
rect(51,152,cpu.retour(),8);
}
if(cpu.retour()>=60&&cpu.retour()<=79){
fill(#006CFF);
noStroke();
rect(0,0,200,200);
fill(#044193);
rect(0,120,200,80);
fill(255,255,255);
rect(25,25,150,150);
stroke(1);
fill(#B2C1C1);
rect(25,25,150,30);
noStroke();
fill(#626C6C);
rect(25,40,150,15);
fill(#F5F3F2);
rect(25,100,150,74);
stroke(1);
fill(#FFFFFF);
textSize(30);
text("CPU TEMP",27,51);
stroke(1);
fill(#0074FF);
textSize(40);
text("C° "+cpu.retour(),45,111);
fill(#CBCBCB);
rect(50,140,100,20);
noStroke();
fill(#6C6C6C);
rect(51,152,99,8);
fill(#F03C0F);
rect(51,141,cpu.retour(),19);
fill(#862209);
rect(51,152,cpu.retour(),8);
}
if(cpu.retour()>=45&&cpu.retour()<=49){
serial.write(cpu.retour()*2);
}
if(cpu.retour()>=50&&cpu.retour()<=80){
serial.write(cpu.retour()*3);
println(cpu.retour()*3);
}
if(cpu.retour()>=0&&cpu.retour()<=44){
serial.write(0);
}
delay(500);
serial.clear();
}
class TempCpu{
int retour(){
String tempCpu[]= loadStrings("/sys/class/thermal/thermal_zone0/temp");
int cpuTemp=int(tempCpu[0])/1000;
return cpuTemp;
}
}]
Et ??????????????????