Esp8266+Ds18b20+DeepSleep

Всем привет я в етом новачок помогите пожалоста зделать deeoSleep в етом коде

    #define BLYNK_PRINT Serial
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <TimeLib.h>
    #include <SimpleTimer.h>
    #define Thermometer 10

    // Pin 10 - Gpio 10

    OneWire oneWire(Thermometer);
    DallasTemperature sensors(&oneWire);

    char auth[] = "cb9e0b23ca35429882f6a6658713174e";

    SimpleTimer timer;

    void setup()
    {
      Serial.begin(9600);
      Blynk.begin(auth, "Tp-link", "Ms0606400");

      sensors.begin();

      timer.setInterval(2000L, sendTemps);
    }

    void sendTemps()
    {
      sensors.requestTemperatures();

      float tempBabyRoom = sensors.getTempCByIndex(0);

      Blynk.virtualWrite(0, tempBabyRoom);
    }

    void loop()
    {
      Blynk.run();
      timer.run();
    }

Don’t understand but for deep sleep you need:

const int sleepTimeS = 900; (Around 15 minutes)

void setup() {  //you will need your blynk setup here as well as blynk.run()
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  reconnect();
 
  dtostrf(getTemp(), 4, 2, temp);
  client.publish("/topic/pooltemp", temp, 1);
  delay(100);
   
  //client.publish("/topics/sleep", "Going To Sleep");
  **ESP.deepSleep(sleepTimeS * 1000000);**
 }

You will add the blynk connection and the Blynk.run()' in the setup routine, during sleep the loop is not active.

The sleep function is your timer, setup is only run once each time your ESP wakes up, thus in setup you need the think along these lines:

Setup Blynk Connection -> Start up your sensors -> Read the temperature -> Send data to blynk (My example is writing to MQTT) -> Sleep

я не могу в этом разобраться нету опыта если можно то зделайте свой скетч