Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
tum_yil_icin_arduino_mufredati_35
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
int INB=12;
int INA=11;
#define sensor_pin A0
#define sensor_pin 8
//Sensörün çalışması için gerekli ön ısıtma süresini 5sn olarak belirliyoruz
#define preheat_time 5000
#define DHTPIN 3
#define DHTTYPE DHT11
DHT dht(DHTPIN,DHTTYPE);
void setup() {
pinMode(3,INPUT);
dht.begin();
lcd.begin();
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}
void loop()
{
float t=dht.readTemperature();
lcd.setCursor(0,0);
lcd.print("sicaklik :");
lcd.print(t);
if(t>30)
{digitalWrite(INA,LOW);
digitalWrite(INB,HIGH);
delay(1000);}
delay(3000);
for(int i=0;i<=16;i++)
{ lcd.setCursor(i,1);
lcd.print(".");
delay(500);
}
lcd.clear();
float n=dht.readHumidity();
lcd.setCursor(0,0);
lcd.print("Nem: ");
lcd.print(n);
delay(3000);
for(int i=0;i<=16;i++)
{ lcd.setCursor(i,1);
lcd.print(".");
delay(500);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hava Kontrol");
lcd.setCursor(0,1);
lcd.print("Ediliyor");
delay(5000);
int sensorValue = analogRead(sensor_pin);
if (sensorValue >= 400)
{ lcd.clear();
lcd.setCursor(0,0);
lcd.print("Zararlı gaz");
lcd.setCursor(0,1);
lcd.print("tespit edildi");
delay(4000);
lcd.clear();
}
else
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hava Temiz");
delay(4000);
lcd.clear();
}
lcd.setCursor(0,0);
lcd.print("Degerler Yeniden");
lcd.setCursor(0,1);
lcd.print("Hesaplaniyor");
delay(3000);
lcd.clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.