Skip to content

Instantly share code, notes, and snippets.

@ihafeez
Forked from neonil123/gas detector
Created September 25, 2020 17:24
Show Gist options
  • Save ihafeez/a0f138a310c1fc55688c5da3b723fa07 to your computer and use it in GitHub Desktop.
Save ihafeez/a0f138a310c1fc55688c5da3b723fa07 to your computer and use it in GitHub Desktop.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "********************************";
char ssid[] = "********************************";
char pass[] = "********************************";
int n;
void setup()
{
Serial.begin(9600);
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);
pinMode(16,OUTPUT);
pinMode(5,OUTPUT);
timer.setInterval(1000L, sendUptime);
}
void sendUptime()
{
Blynk.virtualWrite(V1, n);
}
void loop()
{
Blynk.run();
timer.run();
n=analogRead(A0);
Serial.println(n);
if(n>190)
{
digitalWrite(16,LOW);
digitalWrite(5,HIGH);
}
if(n<190)
{
digitalWrite(16,HIGH);
digitalWrite(5,LOW);
}
}
link for boards
http://arduino.esp8266.com/versions/2.4.2/package_esp8266com_index.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment