You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure Arduino IDE this way to communicate with this board:
27
+
Board type: NodeMCU 1.0 (ESP-12E Module)
28
+
Flash size: 4M (3M SPIFFS)
29
+
CPU Frequency: 80 MHz
30
+
Upload speed: 115200
31
31
32
32
*/
33
33
@@ -64,68 +64,68 @@ unsigned long stateTime1 = 500; //runs until two seconds elapse
64
64
unsignedlong stateTime2 = 500; //runs until two seconds elapse
65
65
66
66
// The NodeMCU onboard LED will blink in sequence when it's successfully connected to the Blynk server
67
-
// (Useful when you install your project in your garage and you don't have access to the Arduino IDE serial monitor)
67
+
// (Useful when you install your project in your garage and you don't have access to the Arduino IDE serial monitor)
68
68
// For the built-in LED on th NodeMCU, LOW = On and HIGH = Off
69
69
BLYNK_CONNECTED() {
70
70
if (isFirstConnect) {
71
71
digitalWrite(wifi, LOW);
72
-
isFirstConnect = false;
73
-
Blynk.virtualWrite(V11, "Checking status...");
74
-
Blynk.virtualWrite(V13, "Checking status...");
75
-
led1.setColor(BLYNK_YELLOW);
76
-
led2.setColor(BLYNK_YELLOW);
77
-
// Not needed, but it will send you a push notification when it's connected. Useful if you reset the board or the Wi-Fi goes down when you're not at home.
78
-
// Uncomment if you want push notifications
79
-
// Blynk.notify("Garage doors connected to Wi-Fi !");
80
-
digitalWrite(wifi, LOW);
81
-
delay(1000);
82
-
digitalWrite(power, HIGH);
83
-
digitalWrite(wifi, HIGH);
84
-
delay(100);
85
-
digitalWrite(power, LOW);
86
-
digitalWrite(wifi, LOW);
87
-
delay(100);
88
-
digitalWrite(power, HIGH);
89
-
digitalWrite(wifi, HIGH);
90
-
delay(100);
91
-
digitalWrite(power, LOW);
92
-
digitalWrite(wifi, LOW);
93
-
delay(100);
94
-
digitalWrite(power, HIGH);
95
-
digitalWrite(wifi, HIGH);
96
-
delay(100);
97
-
digitalWrite(power, LOW);
98
-
digitalWrite(wifi, LOW);
99
-
delay(100);
100
-
digitalWrite(power, HIGH);
101
-
digitalWrite(wifi, HIGH);
102
-
delay(100);
103
-
digitalWrite(power, LOW);
104
-
digitalWrite(wifi, LOW);
105
-
delay(100);
106
-
digitalWrite(power, HIGH);
107
-
digitalWrite(wifi, HIGH);
108
-
delay(100);
109
-
digitalWrite(power, LOW);
110
-
digitalWrite(wifi, LOW);
111
-
delay(100);
112
-
}
113
-
}
72
+
isFirstConnect = false;
73
+
Blynk.virtualWrite(V11, "Checking status...");
74
+
Blynk.virtualWrite(V13, "Checking status...");
75
+
led1.setColor(BLYNK_YELLOW);
76
+
led2.setColor(BLYNK_YELLOW);
77
+
// Not needed, but it will send you a push notification when it's connected. Useful if you reset the board or the Wi-Fi goes down when you're not at home.
78
+
// Uncomment if you want push notifications
79
+
// Blynk.notify("Garage doors connected to Wi-Fi !");
80
+
digitalWrite(wifi, LOW);
81
+
delay(1000);
82
+
digitalWrite(power, HIGH);
83
+
digitalWrite(wifi, HIGH);
84
+
delay(100);
85
+
digitalWrite(power, LOW);
86
+
digitalWrite(wifi, LOW);
87
+
delay(100);
88
+
digitalWrite(power, HIGH);
89
+
digitalWrite(wifi, HIGH);
90
+
delay(100);
91
+
digitalWrite(power, LOW);
92
+
digitalWrite(wifi, LOW);
93
+
delay(100);
94
+
digitalWrite(power, HIGH);
95
+
digitalWrite(wifi, HIGH);
96
+
delay(100);
97
+
digitalWrite(power, LOW);
98
+
digitalWrite(wifi, LOW);
99
+
delay(100);
100
+
digitalWrite(power, HIGH);
101
+
digitalWrite(wifi, HIGH);
102
+
delay(100);
103
+
digitalWrite(power, LOW);
104
+
digitalWrite(wifi, LOW);
105
+
delay(100);
106
+
digitalWrite(power, HIGH);
107
+
digitalWrite(wifi, HIGH);
108
+
delay(100);
109
+
digitalWrite(power, LOW);
110
+
digitalWrite(wifi, LOW);
111
+
delay(100);
112
+
}
113
+
}
114
114
115
115
voidrelayGarageX() {
116
-
if(digitalRead(D7)) lastPress1 = millis();
117
-
if(millis() - lastPress1 < stateTime1){
116
+
if(digitalRead(D7)) lastPress1 = millis();
117
+
if(millis() - lastPress1 < stateTime1){
118
118
digitalWrite(D5, LOW);
119
-
} else {
119
+
} else {
120
120
digitalWrite(D5, HIGH);
121
121
}
122
122
}
123
123
124
124
voidrelayGarageY() {
125
-
if(digitalRead(D9)) lastPress2 = millis();
126
-
if(millis() - lastPress2 < stateTime2){
125
+
if(digitalRead(D9)) lastPress2 = millis();
126
+
if(millis() - lastPress2 < stateTime2){
127
127
digitalWrite(D6, LOW);
128
-
} else {
128
+
} else {
129
129
digitalWrite(D6, HIGH);
130
130
}
131
131
}
@@ -141,10 +141,10 @@ void garageX() {
141
141
led1.setColor(BLYNK_GREEN); // Reed switch is closed, D1 is LOW
142
142
Serial.println("Garage car X is closed");
143
143
Blynk.virtualWrite(V13, "Garage car X is closed");
144
-
}
145
-
}
144
+
}
145
+
}
146
146
147
-
voidgarageY() {
147
+
voidgarageY() {
148
148
if (digitalRead(D3)) {
149
149
led2.setColor(BLYNK_RED); // Reed switch is open, D3 is HIGH
150
150
Serial.println("Garage car Y is open");
@@ -155,7 +155,7 @@ void garageX() {
155
155
led2.setColor(BLYNK_GREEN); // Reed switch is closed, D3 is LOW
156
156
Serial.println("Garage car Y is closed");
157
157
Blynk.virtualWrite(V11, "Garage car Y is closed");
0 commit comments