Loads running in proteus but values not showing blynk even online and all

Hi all
I am making a smart meter(Arduino Uno) in proteus and loads are running but the values not showing in blynk. I don’t know code is accurate for blynk or not. I’m just in the learning stage.


code is here:

 #define BLYNK_PRINT Serial

#include <BlynkSimpleStream.h>
#include <SoftwareSerial.h>


BlynkTimer timer;

char auth[] = "FncsM2KfhsnRZYBwmREINzOqLyRIrtVS";
 
// Power factor variable decleation
float pulswidth = 0;
float powerfactor = 0;
float phase = 0;
//Real power variable declearation
int x;
float V;
double AcsOffset=2.5;
double Sensibl=0.100; 
double I=0;//current
double Readvoltage=0;
double P;// real power
// Reactive power Variable declearition
double Q;// Reactive power
double Reactivepower;
// Apparant Power Variable declearition
double S;
double  X;
double  y;
double B;
double D;
//Frequency variable declearation
const int pulsePin = 7; 
int pulseHigh; // Integer variable to capture High time of the incoming pulse
int pulseLow; // Integer variable to capture Low time of the incoming pulse
float pulseTotal; // Float variable to capture Total time of the incoming pulse
float frequency; // Calculated Frequency
// bills variavle declaration 
double kw;
double kwh;
double Price;
//double cfp;
unsigned long lastmillis = millis();

void myTimerEvent() {
  // power fector
   pulswidth = pulseIn( 8 ,HIGH);
  phase = 2*180*50*pulswidth/1000000;
 // Serial.print("Phase  =");
 // Serial.print(phase);
  //Serial.println(" Degree");
 // Blynk.virtualWrite(V0,phase);
  Serial.print("Power Factor =");
  powerfactor = cos(phase*3.1414/180); 
  Serial.println(powerfactor);
  Blynk.virtualWrite(V0,powerfactor);
  // Voltages  
   Serial.print("\tVoltage  =");
   x=analogRead(A0);
  V=(x* .304177);
  Serial.print(V); 
  Serial.println(" v");
   Blynk.virtualWrite(V1,V);
     // Current
  double Value = analogRead(A1);
  Readvoltage =(Value*5.0/1023);
  Serial.print("\tCurrent  =");
  I=(Readvoltage-AcsOffset)/Sensibl;
  Serial.print(I);
  Serial.println(" Amp");
  Blynk.virtualWrite(V2,I);
   // Real Power
  Serial.print("\tReal Power   =");
  P = V*I*powerfactor;
  delay(400);
  Serial.print(P);
  Serial.println(" Watt");
   Blynk.virtualWrite(V3,V);
     // Reactive Power
  Serial.print("\tReactive Power   =");
 Reactivepower = sin(phase*3.1414/180);
  Q = V*I*Reactivepower;
  Serial.print(Q);
  Serial.println("  KVAR");
  Blynk.virtualWrite(V4,Q);
//   Apparant Power
  Serial.print("\tApparant Power   =");
  X = pow(P, 2);
  y = pow(Q, 2);
  B = sqrt(X);
  D = sqrt(y);
  S =  B+D;
  Serial.print(S);
  Serial.println("  KVA");
  Blynk.virtualWrite(V5,S);
  // frequency 
 // pulseHigh = pulseIn(pulsePin,HIGH);
 // pulseLow = pulseIn(pulsePin,LOW);
 // pulseTotal = pulseHigh + pulseLow; // Time period of the pulse in microseconds
   //Serial.print("\tFrequency   =");
 // frequency=1000000/pulseTotal;      // Frequency in Hertz (Hz)
 //Serial.print(frequency);
// Serial.println(" Hz");
 //Blynk.virtualWrite(V6,frequency);
 //kwh
 Serial.print("\tkwh: ");
 kwh = kwh + S*(millis()-lastmillis)/3600000000.0;
 Serial.println("kwh");
 lastmillis = millis();
 Blynk.virtualWrite(V6, kwh);
 //price
 Serial.print("\tPrice $    =");
  Price = kwh*4; 
  Serial.print(Price);
  Serial.println("Rs");
  Blynk.virtualWrite(V7, Price);
  //carbon foot print
 // Serial.print("\tCarbonfootprint: ");
 // cfp= ((kwh)*(0.85)/(24*365));
 // Serial.print(cfp);
 // Serial.println("cpf");
  //Blynk.virtualWrite(V7, cpf);
  
   
}

void setup() {
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
  pinMode(pulsePin,INPUT);// for frequency 
  Serial.begin(9600);
  Blynk.begin(auth,Serial);
  // Blynk.begin(auth, ssid, pass); 
  //SwSerial.begin(9600);
  //Blynk.begin(SwSerial, auth);
  timer.setInterval(5000L, myTimerEvent);
}
 
void loop() {

 Blynk.run();
  timer.run();   
}

@tejrajadhikari907 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:
```

Pete.

Hii pete,
thank you for replying…but what i know is that all now :upside_down_face: …i m not seeing any triple backticks and all… sorry for that. kindly look into this issue and help me

I’ve given you an example of what triple backticks look like in my post above.
Simply copy them and paste them onto a blank line before and after the code in your post.

Pete.

Hi Pete
ok done…now check it sir

I know nothing about Proteus, but with physical hardware you can’t use the same serial connection for connecting to Blynk via the simplestream library and debugging.

Pete.