Created
April 30, 2018 09:12
-
-
Save neonil123/b4c7c4ebc64baad95542abf175466a79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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