0% found this document useful (0 votes)
11 views6 pages

Practical 7

Uploaded by

RanA KEVIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Practical 7

Uploaded by

RanA KEVIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Practical: 7

• Use Blynk Cloud and demonstrate home automation. Use four devices like bulb
or fan connected with relay and write program to control them using mobile App.
#define BLYNK_TEMPLATE_ID "TMPL3nOGd5Z_0"
#define BLYNK_TEMPLATE_NAME "LAB 7"
#define BLYNK_AUTH_TOKEN "XjdJHreVPEn5fX0lFzLbZVOKaEA2R2pS"
#define BLYNK_PRINT Serial
#include <Adafruit_Sensor.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int D0 = 16;
int D1 = 5;
int D2 = 4;
int D3 = 0;

char ssid[] = "iphone";


char pass[] = "7777949735";
char auth[] = "XjdJHreVPEn5fX0lFzLbZVOKaEA2R2pS";

void setup() {
Serial.begin(9600);
Blynk.begin(auth,ssid,pass);
//timer.setInterval(1000L,send_data);
pinMode(D0,OUTPUT);
pinMode(D1,OUTPUT);
pinMode(D2,OUTPUT);
pinMode(D3,OUTPUT);
}

void loop() {
Blynk.run();
}

BLYNK_WRITE(V1){
int pinValue1 = param.asInt();
if(pinValue1 == 0){
digitalWrite(D0, HIGH);
}
else{
digitalWrite(D0, LOW);
}
}

BLYNK_WRITE(V2){
int pinValue2 = param.asInt();
if(pinValue2 == 0){
digitalWrite(D1, HIGH);
}
else{
digitalWrite(D1, LOW);
}
}

BLYNK_WRITE(V3){
int pinValue3 = param.asInt();
if(pinValue3 == 0){
digitalWrite(D2, HIGH);
}
else{
digitalWrite(D2, LOW);
}
}

BLYNK_WRITE(V4){
int pinValue4 = param.asInt();
if(pinValue4 == 0 ){
digitalWrite(D3, HIGH);
}
else{
digitalWrite(D3, LOW);
}
}

You might also like