Working with IR on blynk 2.0

Dear Pete
I am trying to design a smart parking system using blynk 2.0
I am receiving the following error on blynk 2.0
receiving the error [415154] Connecting to
I have attached the code below.

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>


#define BLYNK_DEVICE_NAME "smart parking"


char ssid[] = "vijay";

char pass[] = "vijay@1234";

int IR_sensor = D1;

int value = 0 ;

void setup()



  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  value = digitalRead(IR_sensor);

  if(value == HIGH){


    Blynk.virtualWrite(V2, value);





    Blynk.virtualWrite(V2, value);





void loop()



Thanks in advance

@vijaysiva 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:

Copy and paste these if you can’t find the correct symbol on your keyboard.


You should read this…

However, when you’ve made that change you sketch won’t work as I suspect you are hoping it will.

void setup only executes once, so the IR sensor will be read just once - when the device boots. In addition, placing a Blynk.virtualWrite in void setup almost certainly won’t write the data to Blynk because although Blynk.begin() has executed Blynk.connected() is not yet true.

And, don’t be tempted to place the IR code that’s currently in void setup into the void loop, this breaks the #1 rule of Blynk.
Instead, you need to set-up a BlynkTimer to call a function on a regular basis and put your IR code in there.

I’m also a bit confused about why this is an IR sensor. If you’re attempting to figure out if a vehicle is parked in a space then why not use a simple LDR, Photodiode or luminance sensor?