Source code for gas sensor with nodemcu

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "fa35d55d100548848eac3eb0b649ddef";              //Your Project authentication key
char ssid[] = "vivo 1609";                                       // Name of your network (HotSpot or Router name)
char pass[] = "kesavvan";                                      // Corresponding Password
int gas_avalue;
int a= D3;
int s= D1;
void setup()
{
  pinMode(s, INPUT);
  pinMode(a, OUTPUT);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}
void loop()
{
  gas_avalue = digitalRead(s);
  if (gas_avalue < 1)
  {
    Serial.println("DANGER!!!!");
    Blynk.notify("DANGER!!!!!");
    digitalWrite(a,HIGH);
  }
  else
  {
    Serial.println("NO LEAKAGE");
    digitalWrite(a,LOW);
  }
  delay(100);
  Blynk.run();
}

Comments

Popular Posts