NODE MCU || HOME AUTOMATION || IOT



Hey guys! Iam came up with a new project iot based home automation .

  Download latest Blynk library here:    https://github.com/blynkkk/blynk-library/releases/latest


CODE 1:-

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "ENTER YOUR AUTH TOKEN";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ENTER YOUR WIFI USER NAME";
char pass[] = "ENTER YOUR WIFI PASSWORD";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

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






CODE 2:-

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "ENTER YOUR AUTH TOKEN";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ENTER YOUR WIFI USER NAME";
char pass[] = "ENTER YOUR WIFI PASSWORD";


  const int Relay_1 = 5;        //D1
  const int Relay_2 = 4;        //D2
  const int Relay_3 = 0;        //D3
  const int Relay_4 = 2;        //D4


void setup()
{
  pinMode(Relay_1, OUTPUT);
  pinMode(Relay_2, OUTPUT);
  pinMode(Relay_3, OUTPUT);
  pinMode(Relay_4, OUTPUT);


    digitalWrite(Relay_1, LOW);
    digitalWrite(Relay_2, LOW);
    digitalWrite(Relay_3, LOW);
    digitalWrite(Relay_4, LOW);


  
  // Debug console
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);

}

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



Post a Comment

0 Comments