Blynk Edgent and DS18b20

I have problem with nodemcu - blynk 2.0 and DS18B20. When program start, everythings is ok DS18b20 write temperature ok. When blynk edgent conecting blynk and is online DS18b20 write -127 C…

#define BLYNK_DEVICE_NAME "***********************"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#include <Blynk.h>
BlynkTimer timer;
#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI
#include <SimpleTimer.h>
#include<DallasTemperature.h>
#include <OneWire.h>
#include "BlynkEdgent.h"
#define ONE_WIRE_BUS 12 
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
void setup()
{
  Serial.begin(115200);
  delay(100);
  DS18B20.begin();
timer.setInterval(5000L, getSendData);  

  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
  timer.run();
  
}
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(V6, (temp));
    ```

please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly. Triple backticks look like this: ```

As @Madhukesh stated please format your code.
That being said, take a look through the tabs in the Edgent sketch, I feel pin 2 is used for something in the sketch already for some boards.

Try another pin and see if the problem persists.

Thank you. Another pin fixed it :wink:

@Marcel_Vasut I’ve deleted your code, because you didn’t follow the instructions about correctly formatting code when you created the topic, and refused to fix the issue despite being asked to do so by two community members.

You have broken one of the golden rules of Blynk, bu using blocking code in your void loop.
I’d suggest that you fix that issue.

Pete.

Corrected :wink:

Your ‘corrected’ code is considerably different to your original code, and is incomplete.

When you put triple backticks before and after your code they need to be on separate lines.

Pete.