Skip to content

Instantly share code, notes, and snippets.

@neonil123
Created April 30, 2018 09:12
Show Gist options
  • Save neonil123/b4c7c4ebc64baad95542abf175466a79 to your computer and use it in GitHub Desktop.
Save neonil123/b4c7c4ebc64baad95542abf175466a79 to your computer and use it in GitHub Desktop.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS D2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char auth[] ="**************************";
char ssid[] ="**************************";
char pass[] ="**************************";
int sensor=0;
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
sensors.begin();
}
void sendTemps()
{
sensor=analogRead(A0);
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
Serial.println(temp);
Serial.println(sensor);
Blynk.virtualWrite(V1, temp);
Blynk.virtualWrite(V2,sensor);
delay(1000);
}
void loop()
{
Blynk.run();
sendTemps();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment