-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGarage_Opener.ino
45 lines (39 loc) · 1.23 KB
/
Garage_Opener.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
/*------------------------------------------------------------------------------------------
This Project uses an existing garage door opener and connects directly to the switch to be
pressed by the user. The ESP8266 gets the input from the Blynk app and translates it
into the relay to open or close the garage door.
------------------------------------------------------------------------------------------*/
/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial
#define Button 4
#define LED 5
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = ""; //Blynk project auth code
char ssid[] = ""; // My WIFI network name
char pass[] = ""; // My WIFI network password
/* This function reads the input from virtual input in the Blynk app and writes it to a variable here*/
BLYNK_WRITE(V1)
{
int up = param.asInt(); // assigning incoming value from pin V1 to a variable
if (up==1)
{
digitalWrite(Button, HIGH);
digitalWrite(LED, HIGH);
}
else
{
digitalWrite(Button, LOW);
digitalWrite(LED, LOW);
}
}
void setup()
{
Blynk.begin(auth, ssid, pass);
pinMode(Button, OUTPUT);
pinMode(LED, OUTPUT);
}
void loop()
{
Blynk.run();
}