-
Notifications
You must be signed in to change notification settings - Fork 0
/
IOT Project.ino
61 lines (60 loc) · 1.14 KB
/
IOT Project.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <LiquidCrystal.h>
#include <dht.h>
#define dht_apin A1
dht DHT;
LiquidCrystal lcd(13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3);
int sensorValue;
void setup() {
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Welcome");
lcd.setCursor(0,1);
lcd.print("Loading ...");
delay(1000);
}
void loop()
{
DHT.read11(dht_apin);
sensorValue = analogRead(0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Air Qua: ");
lcd.print(sensorValue,DEC);
lcd.print(" PPM");
lcd.setCursor(0,1);
if (sensorValue<50)
{
lcd.print("Good");
}
if (sensorValue>51&&sensorValue<=100)
{
lcd.print("Satisfactory");
}
if (sensorValue>=101&&sensorValue<=200)
{
lcd.print("Moderate");
}
if (sensorValue>=201&&sensorValue<=300)
{
lcd.print("Poor");
}
if (sensorValue>=301&&sensorValue<=400)
{
lcd.print("VERY POOR ! ! !");
}
if (sensorValue>401)
{
lcd.print("SEVERE ! ! !");
}
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Humidity: ");
lcd.print(DHT.humidity);
lcd.print("%");
lcd.setCursor(0,1);
lcd.print("Temp: ");
lcd.print(DHT.temperature);
lcd.print(" C");
delay(2000);
}