Why it shows d2 was not declared in scope #define BLYNK_PRINT Serial   
#include &lt;SPI.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;BlynkSimpleEsp8266.h&gt;
#include &lt;SimpleTimer.h&gt;
#include &lt;DHT.h&gt;
#define BLYNK_PRINT Serial
#include &lt;OneWire.h&gt;
#include &lt;DallasTemperature.h&gt;
#define ONE_WIRE_BUS D2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&amp;oneWire);
char auth[] =&quot;your auth token&quot;; 
char ssid[] = &quot;your wifi name&quot;; 
char pass[] = &quot;your wifi password&quot;; 

#define DHTPIN 2    
#define DHTTYPE DHT11     
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    Serial.println(&quot;Failed to read from DHT sensor!&quot;);
    return;
  }
 
  Blynk.virtualWrite(V5, h);  //V5 is for Humidity
  Blynk.virtualWrite(V6, t);  //V6 is for Temperature
}

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
   
  dht.begin();

  timer.setInterval(1000L, sendSensor);
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
   sensors.begin();
}

int sensor=0;

void sendTemps()
{
  sensor=analogRead(A0);
  sensors.requestTemperatures();
  float temp = sensors.getTempCByIndex(0); 
  Serial.println(temp);
  Serial.println(sensor);
  Blynk.virtualWrite(V1, temp);
  Blynk.virtualWrite(V2,sensor);
  delay(1000);
}

void loop()
{
  Blynk.run(); 
  timer.run(); 
  sendTemps();
}
Arduino pins are defined only by a simple number, with the exception that the analog pins are also named as 'A0' through 'A8' (or however many analog pins the specific processor has). Thus, D2 is not defined. If you mean to refer to Arduino pin 2, its name is just '2'. So:
#define ONE_WIRE_BUS D2  -&gt;  #define ONE_WIRE_BUS 2