ESP8266, DS18B20 and Blynk 2.0

Thanks, apparently I’m not smart :slight_smile:
Everything has worked, who needs it, take it :slight_smile:
Three sensors DS10B20

//* ESP & Blynk *
#define BLYNK_TEMPLATE_ID           "111111111111111"
#define BLYNK_DEVICE_NAME           "222222222222222"
#define BLYNK_AUTH_TOKEN            "3333333333333333333333"
//* Blynk Данные *
char auth[] = BLYNK_AUTH_TOKEN; //"Код аутентефикации с приложения blynk

//* WiFi WiFi Данные *
char ssid[] = "0000000"; //"имя сети вай-фай"
char pass[] = "000000000"; //"пароль от вай-фая"

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS D4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
BlynkTimer timer;


float temp1, temp2,temp3;  

   
    void setup()
    {
     Serial.begin(115200);
     sensors.begin();
     Blynk.begin(auth, ssid, pass);
     timer.setInterval(30000L, sendTemps);
         
    }
  
void sendTemps()
  {
  sensors.requestTemperatures(); // Polls the sensors
  temp1  = sensors.getTempCByIndex(0); // Gets first pr
  temp2  = sensors.getTempCByIndex(1); // Gets first pr
  temp3  = sensors.getTempCByIndex(2); // Gets first pr
  Serial.println(temp1);
  Serial.println(temp2);
  Serial.println(temp3);
  Blynk.virtualWrite(V1, temp1); //вывод значений влажности в БЛИНК
  Blynk.virtualWrite(V2, temp2);
  Blynk.virtualWrite(V3, temp3);  
  }
  
    void loop()
    {
       Blynk.run();
       timer.run();    
    }
3 Likes