Last active
October 28, 2019 07:17
-
-
Save RobolinkAkademi/f582fc614ff11d28e652332d38588574 to your computer and use it in GitHub Desktop.
tum_yil_icin_arduino_mufredati_35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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