Devices & Components
LED Light Bulb, Frosted GLS
NodeMCU ESP8266 Breakout Board
Relay Module (Generic)
Jumper wires (generic)
Arduino 101
Micro-USB to USB Cable (Generic)
Software & Tools
Arduino IDE
Blynk
Project description
Code
Code for Arduino
arduino
1#define BLYNK_TEMPLATE_ID "# Your template id" 2#define BLYNK_DEVICE_NAME "# Your Dvice Name" 3#define BLYNK_AUTH_TOKEN "# Your Auth token" 4 5#define BLYNK_PRINT Serial 6 7#include <ESP8266WiFi.h> 8#include <BlynkSimpleEsp8266.h> 9 10char auth[] = BLYNK_AUTH_TOKEN; 11 12char ssid[] = "# Your SSid"; 13char pass[] = "Your SSid Password"; 14 15BLYNK_WRITE(V0) 16{ 17 int value = param.asInt(); 18 Serial.println(value); 19 if(value == 1) 20 { 21 digitalWrite(D5, LOW); 22 Serial.println("LED ON"); 23 } 24 if(value == 0) 25 { 26 digitalWrite(D5, HIGH); 27 Serial.println("LED OFF"); 28 } 29} 30 31BLYNK_WRITE(V1) 32{ 33 int value = param.asInt(); 34 Serial.println(value); 35 if(value == 1) 36 { 37 digitalWrite(D6, LOW); 38 Serial.println("LED ON"); 39 } 40 if(value == 0) 41 { 42 digitalWrite(D6, HIGH); 43 Serial.println("LED OFF"); 44 } 45} 46 47BLYNK_WRITE(V2) 48{ 49 int value = param.asInt(); 50 Serial.println(value); 51 if(value == 1) 52 { 53 digitalWrite(D7, LOW); 54 Serial.println("LED ON"); 55 } 56 if(value == 0) 57 { 58 digitalWrite(D7, HIGH); 59 Serial.println("LED OFF"); 60 } 61} 62 63BLYNK_WRITE(V3) 64{ 65 int value = param.asInt(); 66 Serial.println(value); 67 if(value == 1) 68 { 69 digitalWrite(D8, LOW); 70 Serial.println("LED ON"); 71 } 72 if(value == 0) 73 { 74 digitalWrite(D8, HIGH); 75 Serial.println("LED OFF"); 76 } 77} 78 79 80void setup() 81{ 82 Serial.begin(115200); 83 Blynk.begin(auth, ssid, pass); 84 pinMode(D5,OUTPUT); 85 pinMode(D6,OUTPUT); 86 pinMode(D7,OUTPUT); 87 pinMode(D8,OUTPUT); 88} 89 90void loop() 91{ 92 Blynk.run(); 93}
Downloadable files
Home Automation Circuit Diagram
Home Automation Circuit Diagram

Comments
Only logged in users can leave comments