Blynk.virtualWrite - 'Blynk' does not name a type

Hi guys, I’m working on my final project using ESP8266 Node MCU and display value on Blynk IoT 2.0. So I use DS18b20 as a temperature sensor and YL - 69 as a moisture sensor. It’s working properly to print on serial. The problem is when I started to connect to Blynk using Blynk.virtualWrite, i had some problem with it.

It said “‘Blynk’ does not name a type”

Here is my code:

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLdrZDyMrO"
#define BLYNK_DEVICE_NAME "Smart Plant"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

#include <OneWire.h>
#include <DallasTemperature.h>

#define led D1
boolean bt_state=HIGH;
unsigned long times=millis();
#include "BlynkEdgent.h"



int moisture_pin = A0;
int moisture_value ;

const int oneWireBus = 4;  
  

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

void setup()
{
  Serial.begin(115200);
  sensors.begin();
  delay(100);
  pinMode(led, OUTPUT);
  BlynkEdgent.begin();
}

BLYNK_WRITE(V0)
{
  int pinLED = param.asInt();
  digitalWrite(led, pinLED);
}


void loop() {

  
  BlynkEdgent.run();

    sensors.requestTemperatures(); 
    float temperature = sensors.getTempCByIndex(0);
   //do am dat
    moisture_value = analogRead(moisture_pin);
    moisture_value = map(moisture_value,1024,552,0,100); 
    }
    Blynk.virtualWrite(V2,moisture_value);
    Blynk.virtualWrite(V3,temperature);
    Serial.print("Do am dat : "); 
    Serial.print(moisture_value);
    Serial.print("%\n");
    Serial.print("Nhiet do : ");   
    Serial.print(temperature);
    Serial.println("ºC");
   
    delay(5000);

}

Please edit your post and add triple backticks ( ``` ) before and after your whole sketch.

Sorry, i’m new to this. Thanks for your advice

First of all, you should read this
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

Posting the relevant part of your compiler output (copy/paste the text and use triple backticks again - do not post a screenshot) would be helpful.

Also, you’ve delete all of the board type definitions without un-commenting one of them, so the custom board type will be used. That means your LED and boot button will not work as expected during the provisioning process, and you may have conflicts between the custom board type pins and your sensors.
You should read this for more info…

Pete.