-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChiriSmartHome.ino
68 lines (49 loc) · 1.32 KB
/
ChiriSmartHome.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
#define BLYNK_TEMPLATE_ID "TMPL5TZMXU7Jy"
#define BLYNK_TEMPLATE_NAME "ChiriSmartHome"
#define BLYNK_AUTH_TOKEN "BsjiLCgMQfkqwSc3ifh5ArYUqy66Qyug"
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ocean";
char pass[] = "iris2012";
//Software Serial on Uno
#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 38400
ESP8266 wifi(&EspSerial);
void setup()
{
// Debug console
Serial.begin(115200);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);
}
void loop()
{
Blynk.run();
}
BLYNK_WRITE(V1)
{
int button1Value = param.asInt(); // assigning incoming value from pin V1 to a variable
digitalWrite(relay1, button1Value);
}
BLYNK_WRITE(V2)
{
int button2Value = param.asInt(); // assigning incoming value from pin V2 to a variable
digitalWrite(relay2, button2Value);
}
BLYNK_WRITE(V3)
{
int button3Value = param.asInt(); // assigning incoming value from pin V3 to a variable
digitalWrite(relay3, button3Value);
}
BLYNK_WRITE(A1)
{
int button4Value = param.asInt(); // assigning incoming value from pin A1 to a variable
analogWrite(relay4, fan);
}