Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
666 B
1
Indexable
Never
#define lm35 A0
#define eksi 7
#define arti 6
#define led 13
float ayar=1;
float okunanDeger;
float sicaklik;

void setup() {
  pinMode(led,OUTPUT);
  pinMode(arti,INPUT_PULLUP);
  pinMode(eksi,INPUT_PULLUP);
  Serial.begin(9600);

}

void loop() {
if(digitalRead(eksi)==0)
{
  ayar-=1;
  delay(200);
}
else if(digitalRead(arti)==0)
{
  ayar+=1;
  delay(200);
}
Serial.print("ayar=");Serial.println(ayar);
okunanDeger=analogRead(lm35);
sicaklik=okunanDeger*0.488;

Serial.print("oda sıcaklığı=");Serial.println(sicaklik);
if(ayar>sicaklik)
{
  digitalWrite(led,HIGH);
  
}
else
{
  digitalWrite(led,LOW);
}
delay(500);
}