Smartphone Proximity IOT

 IOT  (Controlling a relay with Smartphone Proximity sensor and Blynk App)


#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[] = "xGtkkxzmpdsHvdmWXiw4_9f97y-yT8dU";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "dewa406";
char pass[] = "Ramesh16384";

void setup()
{
  // Debug console
  Serial.begin(9600);
pinMode(D1,OUTPUT);
pinMode(LED_BUILTIN,OUTPUT);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
}
BLYNK_WRITE(V1)
{
  int proximity=param.asInt();
  if(proximity)
  {
    digitalWrite(D1,HIGH);
    digitalWrite(LED_BUILTIN,LOW);
  }
  else
  {
    digitalWrite(D1,LOW);
    digitalWrite(LED_BUILTIN,HIGH);
  }
}

Comments

Popular posts from this blog

4 Stage Timer With DS3231RTC Module.

Interfacing KY038 sound sensor with Raspberry pi Pico

Interfacing MQ2 Gas & Smoke Sensor With Raspberry Pi Pico