#define BLYNK_TEMPLATE_ID "TMPLhgfWcuh4"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "EX5b-NLSVTF08VONqb6YlwMjy8um5OfF"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char ssid[] = "bb";
char pass[] = "amirizzani12";
char auth[] = BLYNK_AUTH_TOKEN;
const int sensorPin = A0;
const int minReading = 0;
const int maxReading = 500;
void setup() {
{
sensors.begin();
}
{
Serial.begin(9600);
// Connect to WiFi
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED)
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Connect to Blynk
Blynk.begin(auth, ssid, pass);
Serial.println("Blynk connected");
}
void loop() {
// Read the analog value from the sensor
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
sensors.requestTemperatures();
float temperature = sensors.getTempCByIndex(0);
Blynk.virtualWrite(V1, temperature);
// Send the value to Blynk
Blynk.virtualWrite(V0, sensorValue);
// Wait a little before reading the sensor again
delay(1000);
}
19:32:53.254 → WiFi connected
19:32:53.254 → [4041] Connecting to bb
19:32:53.288 → [4067] Connected to WiFi
19:32:53.322 → [4094] IP: 192.168.245.38
19:32:53.357 → [4122]
19:32:53.357 → ___ __ __
19:32:53.392 → / _ )/ /_ _____ / /__
19:32:53.426 → / _ / / // / _ / '/
19:32:53.459 → ///_, /////_
19:32:53.459 → /__/ v1.0.1 on ESP8266
19:32:53.493 →
19:32:53.526 → [4278] Connecting to blynk.cloud:80
19:32:53.593 → [4501] Ready (ping: 63ms).
19:32:53.661 → Blynk connected
19:32:53.661 → 8
19:32:55.473 → 6
19:32:57.290 → 3
19:32:59.104 → 6
19:33:00.925 → 6
19:33:02.768 → 7
19:33:04.587 → 8
19:33:06.407 → 17
19:33:08.234 → 14
19:33:10.055 → 4
19:33:11.873 → 3
19:33:13.687 → 13
19:33:15.519 → 7
19:33:17.338 → 16
19:33:19.165 → 17
19:33:20.975 → 8
19:33:22.779 → 4
19:33:24.623 → 3
19:33:26.440 → 13
19:33:28.267 → 14
19:33:30.088 → 8