-
Notifications
You must be signed in to change notification settings - Fork 1
/
Smart_parking_blynk.ino
92 lines (73 loc) · 1.89 KB
/
Smart_parking_blynk.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
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "qqcltIf7wZQMUdcU1nhwvk_khauTjLN1";
char ssid[] = "k27";
char password[] = "987654321";
int ir11=16;
int ir22=5;
WidgetLCD lcd(V1);
WidgetLED led1(V2);
WidgetLED led2(V3);
void setup()
{
Serial.begin(115200);
pinMode(ir11,INPUT);
pinMode(ir22,INPUT);
// Connect to WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Blynk.begin(auth, ssid, password);
lcd.clear();
}
void loop()
{
Blynk.run();
int ir1=digitalRead(ir11);
int ir2=digitalRead(ir22);
if (ir1==LOW && ir2==LOW )
{
lcd.clear();
lcd.print(0,0,"Slot 1 : Empty Slot 2 : Empty");
led1.off();
led2.off();
Blynk.email("[email protected]","SMART PARKING","Slot 1 : Empty Slot 2 : Empty");
delay(400);
}
else if (ir1==LOW && ir2==HIGH)
{
lcd.clear();
lcd.print(0,0,"Slot 1 : Empty Slot 2 : Full");
led1.off();
led2.on();
Blynk.email("[email protected]","SMART PARKING","Slot 1 : Empty Slot 2 : Full");
delay(400);
}
else if (ir1==HIGH && ir2==LOW)
{
lcd.clear();
lcd.print(0,0,"Slot 1 : Full Slot 2 : Empty");
led1.on();
led2.off();
Blynk.email("[email protected]","SMART PARKING","Slot 1 : Full Slot 2 : Empty");
delay(400);
}
else if (ir1==HIGH && ir2==HIGH)
{
lcd.clear();
lcd.print(0,0,"Slot 1 : Full Slot 2 : Full");
led1.on();
led2.on();
Blynk.email("[email protected]","SMART PARKING","Slot 1 : Full Slot 2 : Full");
delay(400);
}
}