Proteus and UltraSonic Sensor

I am trying to calculate distance using Ultrasonic Sensor in Proteus and send it to Blynk. I am using Arduino Mega. The connection is using emulator port. ( no physical component). I can see that calculating distance and connecting to Blynk work well. But when these two combined, it does not show anything.

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Blynk.h>
#include <BlynkSimpleStream.h>
BlynkTimer timer;

const int trigPin = 22; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 23; // Echo Pin of Ultrasonic Sensor
long duration, distance;

 // You should get Auth Token in the Blynk App.
 // Go to the Project Settings (nut icon).
 char auth[] = "kZBRrdCPjMlV3VPg4W-Ko57XcE0xK-eS";
  int pinValue =  param.asInt();
  Blynk.virtualWrite(V1,distance);// virtualpin 1 distance 
void setup()
   Blynk.begin(auth, Serial);
   timer.setInterval(1000, MeasureCm); //the function dataprocess run every sec
   pinMode(trigPin, OUTPUT); // initialising pin 22 as output
   pinMode(echoPin, INPUT); // initialising pin 23 as input   

void MeasureCm()
     digitalWrite(trigPin, LOW); 

     digitalWrite(trigPin, HIGH);
     digitalWrite(trigPin, LOW);
     duration = pulseIn(echoPin, HIGH);
     //Calculate the distance (in cm) based on the speed of sound.
     distance = duration/58.2;
     Serial.print("Distance: ");
void loop()