Termostat kode


const int lm35 = 39;
const int heat = 23;
const int blow = 22;

int sensorValue=0;

void setup() {
  // put your setup code here, to run once:
     pinMode(heat, OUTPUT);
     pinMode(blow, OUTPUT);
     Serial.begin(115200);      }

void loop() {
  // put your main code here, to run repeatedly:
  sensorValue = analogRead(lm35);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  sensorValue = map(sensorValue,0,4096,0,800);
  Serial.print("\t output = ");
  Serial.println(sensorValue);
  if (sensorValue<=25){
      digitalWrite (heat,HIGH);
      digitalWrite (blow,LOW);}
  else {
      digitalWrite (heat,LOW);
      digitalWrite (blow,LOW);}  
   if (sensorValue>=29){
      digitalWrite (heat,LOW);
      digitalWrite (blow,HIGH);}    
delay (1000);
}