-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch_sep06a.ino
executable file
·133 lines (114 loc) · 2.38 KB
/
sketch_sep06a.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <Adafruit_BMP085.h>
#define DHTPIN 14
#define DHTPIN1 2
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
DHT dht1(DHTPIN1, DHTTYPE);
BlynkTimer timer;
Adafruit_BMP085 bmp;
char auth[] = "";
char ssid[] = "";
char pass[] = "";
WidgetLED snow(V5);
WidgetLED low(V6);
WidgetLED ice(V7);
WidgetLED rain(V8);
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
dht1.begin();
timer.setInterval(600000L, readtemp);
lcd.begin();
lcd.backlight();
bmp.begin();
}
void readtemp()
{
int h = dht.readHumidity();//outside
Blynk.virtualWrite(V1, h);
int t = dht.readTemperature();//outside
Blynk.virtualWrite(V2, t);
int h1 = dht1.readHumidity();
Blynk.virtualWrite(V3, h1);
int t1 = dht1.readTemperature();
Blynk.virtualWrite(V4, t1);
float prs = bmp.readPressure() / 133.33;
Blynk.virtualWrite(V9, prs);
//LCD part
lcd.setCursor(0, 0);
lcd.print("IN ");
lcd.print(t, 1);
lcd.setCursor(5, 0);
lcd.print("C");
lcd.setCursor(6, 0);
lcd.print("#");
lcd.setCursor(7, 0);
lcd.print(h, 1);
lcd.setCursor (9, 0);
lcd.print("%");
lcd.setCursor (10, 0);
lcd.print("#");
lcd.setCursor (11, 0);
lcd.print(prs);
lcd.setCursor (15, 0);
lcd.print("H");
//down row
lcd.setCursor(0, 1);
lcd.print("OUT ");
lcd.print(t1);
lcd.setCursor(7, 1);
lcd.print("C");
lcd.setCursor (8, 1);
lcd.print("#");
lcd.setCursor (9, 1);
lcd.print(h1);
lcd.setCursor (11, 1);
lcd.print("%");
if (h1 > 70 && t1 < -2 ) {
snow.on();
ice.off();
rain.off();
lcd.setCursor (12, 1);
lcd.print("SNOW");
}
else if (h1 < 70 && t1 < -10) {
ice.on();
snow.off();
rain.off();
lcd.setCursor (12, 1);
lcd.print("ICE");
}
else if (h1 > 70 && t1 > 5)
{ rain.on();
ice.off();
snow.off();
lcd.setCursor (12, 1);
lcd.print("RAIN");
}
else
{
rain.off();
ice.off();
snow.off();
lcd.setCursor (12, 1);
lcd.print("SUN");
}
}
BLYNK_WRITE(V10)
{
readtemp();
}
void loop()
{
Blynk.run();
timer.run(); // SimpleTimer is working
}