Étape 4: Coder!!!
Code est:-
temp de flotteur ;
int setValue = 40 ;
int tempPin = A0 ;
fan d’int = 9 ;
#include innovente lcd (7, 6, 5, 4, 3, 2) ;
void setup() {}
LCD.Begin (16, 2) ;
pinMode(fan,OUTPUT) ;
Serial.Begin(9600) ;
}
void loop() {}
LCD.Clear() ;
Temp = analogRead(tempPin) ;
Temp = temp * 0.48828125 ;
Si (temp setValue) {}
int fanpwm = map(temp,setValue,140,75,255) ;
analogWrite(fan,fanpwm) ;
LCD.Clear() ;
LCD.Print("Warning") ;
lcd.setCursor(0,1) ;
LCD.Print ("High Temp:-") ;
lcd.setCursor(11,1) ;
LCD.Print(temp) ;
Delay(40) ;
}
}