Skip to content

Commit cc23953

Browse files
committed
Formatted some files
1 parent d4e98ea commit cc23953

File tree

1 file changed

+75
-75
lines changed

1 file changed

+75
-75
lines changed

GarageDoors/OneDoor/OneDoor.ino

+75-75
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
/*
22
3-
Programm to control one garage door of your house - Julien Muggli, 2018
4-
Github link: https://github.com/Liozon/Blynk/tree/master/GarageDoors/OneDoor
5-
6-
You'll need: a NodeMCU board, one relay switch and one reed switch
7-
And of course: the Blynk app !
8-
9-
Links for product purchase:
10-
NodeMCU: (eBay) http://tiny.cc/7mioly
11-
Relay switch - pack of 5: (eBay) http://tiny.cc/npioly
12-
Reed switch - pack of 5: (eBay) http://tiny.cc/pqioly
13-
400 pins breadboards: (eBay) http://tiny.cc/ntioly
14-
Jumper wires - 120 Pcs: (eBay) http://tiny.cc/rvioly
15-
16-
NodeMCU PIN connection:
17-
D3 => connect to reed switch 1
18-
D5 => connect to relay switch 1
19-
20-
Blynk app widgets:
21-
LED: connect to PIN V1
22-
Value display: connect to V0
23-
Button: connect to D5
24-
25-
Configure Arduino IDE this way to communicate with this board:
26-
Board type: NodeMCU 1.0 (ESP-12E Module)
27-
Flash size: 4M (3M SPIFFS)
28-
CPU Frequency: 80 MHz
29-
Upload speed: 115200
3+
Programm to control one garage door of your house - Julien Muggli, 2018
4+
Github link: https://github.com/Liozon/Blynk/tree/master/GarageDoors/OneDoor
5+
6+
You'll need: a NodeMCU board, one relay switch and one reed switch
7+
And of course: the Blynk app !
8+
9+
Links for product purchase:
10+
NodeMCU: (eBay) http://tiny.cc/7mioly
11+
Relay switch - pack of 5: (eBay) http://tiny.cc/npioly
12+
Reed switch - pack of 5: (eBay) http://tiny.cc/pqioly
13+
400 pins breadboards: (eBay) http://tiny.cc/ntioly
14+
Jumper wires - 120 Pcs: (eBay) http://tiny.cc/rvioly
15+
16+
NodeMCU PIN connection:
17+
D3 => connect to reed switch 1
18+
D5 => connect to relay switch 1
19+
20+
Blynk app widgets:
21+
LED: connect to PIN V1
22+
Value display: connect to V0
23+
Button: connect to D5
24+
25+
Configure Arduino IDE this way to communicate with this board:
26+
Board type: NodeMCU 1.0 (ESP-12E Module)
27+
Flash size: 4M (3M SPIFFS)
28+
CPU Frequency: 80 MHz
29+
Upload speed: 115200
3030
3131
*/
3232

@@ -60,63 +60,63 @@ unsigned long lastPress1 = 0;
6060
unsigned long stateTime1 = 500; //runs until two seconds elapse
6161

6262
// The NodeMCU onboard LED will blink in sequence when it's successfully connected to the Blynk server
63-
// (Useful when you install your project in your garage and you don't have access to the Arduino IDE serial monitor)
63+
// (Useful when you install your project in your garage and you don't have access to the Arduino IDE serial monitor)
6464
// For the built-in LED on th NodeMCU, LOW = On and HIGH = Off
6565
BLYNK_CONNECTED() {
6666
if (isFirstConnect) {
6767
digitalWrite(wifi, LOW);
68-
isFirstConnect = false;
69-
Blynk.virtualWrite(V0, "Checking status...");
70-
led.setColor(BLYNK_YELLOW);
71-
// 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.
72-
// Uncomment if you want push notifications
73-
//Blynk.notify("Garage doors connected to Wi-Fi !");
74-
digitalWrite(wifi, LOW);
75-
delay(1000);
76-
digitalWrite(power, HIGH);
77-
digitalWrite(wifi, HIGH);
78-
delay(100);
79-
digitalWrite(power, LOW);
80-
digitalWrite(wifi, LOW);
81-
delay(100);
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-
}
107-
}
68+
isFirstConnect = false;
69+
Blynk.virtualWrite(V0, "Checking status...");
70+
led.setColor(BLYNK_YELLOW);
71+
// 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.
72+
// Uncomment if you want push notifications
73+
//Blynk.notify("Garage doors connected to Wi-Fi !");
74+
digitalWrite(wifi, LOW);
75+
delay(1000);
76+
digitalWrite(power, HIGH);
77+
digitalWrite(wifi, HIGH);
78+
delay(100);
79+
digitalWrite(power, LOW);
80+
digitalWrite(wifi, LOW);
81+
delay(100);
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+
}
107+
}
108108

109109
void relayGarageLexus() {
110-
if(digitalRead(D5)) lastPress1 = millis();
111-
if(millis() - lastPress1 < stateTime1){
110+
if (digitalRead(D5)) lastPress1 = millis();
111+
if (millis() - lastPress1 < stateTime1) {
112112
digitalWrite(D7, LOW);
113-
} else {
113+
} else {
114114
digitalWrite(D7, HIGH);
115115
}
116-
}
116+
}
117117

118118
void garageDoor() {
119-
if (digitalRead(D3)) {
119+
if (digitalRead(D3)) {
120120
led.setColor(BLYNK_RED); // Reed switch is open, D3 is HIGH
121121
Serial.println("Garage car X is open");
122122
Blynk.virtualWrite(V0, "Garage car X is open");
@@ -126,7 +126,7 @@ void garageDoor() {
126126
led.setColor(BLYNK_GREEN); // Reed switch is closed, D3 is LOW
127127
Serial.println("Garage car X is closed");
128128
Blynk.virtualWrite(V0, "Garage car X is closed");
129-
}
129+
}
130130
}
131131

132132
void setup()
@@ -145,7 +145,7 @@ void setup()
145145
// You can also specify server:
146146
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
147147
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
148-
148+
149149
// Turning LED in the Blynk app on
150150
led.on();
151151
timer.setInterval(1500, garageDoor);

0 commit comments

Comments
 (0)