Blynk.virtualWrite Command not working

Hello everyone, i need a help with my code. Im trying the use blynk.virtualWrite command on my function. But the simulation that i used a gave me an error. Can you guys see any mistake on my code thanks.

That is my main code

#define BLYNK_PRINT SwSerial
#include "kutuphane.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX

#include <BlynkSimpleStream.h>
#define ledPin1    4
#define ledPin2    5
#define ledPin3    6
#define ledPin4    7


#define vPin1    V12
#define vPin2    V13
#define vPin3    V14
#define vPin4    V15

#define sensor1  A0
#define sensor2  A1
#define sensor3  A2
#define sensor4  A3
#define sensor5  A4
#define sensor6  A5

float temp;


char auth[] = "Rn4MzFKwTAxOIljim9N_O6mGI3XUtgcQ";
int uyari = 0;
int uyari1 = 0;
int uyari2 = 0;
int uyari3 = 0;
int uyari4 = 0;

int i = 0;
int switch_1_ON = 0;
int ledPinState1 = LOW;
int ledPinState2 = LOW;
int ledPinState3 = LOW;
int ledPinState4 = LOW;

int SensorValue, SensorValue1, SensorValue2, SensorValue3, SensorValue4, SensorValue5;



BlynkTimer timer;

BLYNK_CONNECTED() {

  // Request the latest state from the server

  Blynk.syncVirtual(vPin1);
  Blynk.syncVirtual(vPin2);
  Blynk.syncVirtual(vPin3);
  Blynk.syncVirtual(vPin4);

}
BLYNK_WRITE(vPin1) {
  ledPinState1 = param.asInt();
  digitalWrite(ledPin1, ledPinState1);
}

BLYNK_WRITE(vPin2) {
  ledPinState2 = param.asInt();
  digitalWrite(ledPin2, ledPinState2);
}
BLYNK_WRITE(vPin3) {
  ledPinState3 = param.asInt();
  digitalWrite(ledPin3, ledPinState3);
}
BLYNK_WRITE(vPin4) {
  ledPinState4 = param.asInt();
  digitalWrite(ledPin4, ledPinState4);
}



void vanaKapa() {
  ledPinState1 = 0;
  Blynk.virtualWrite(vPin1, 0);
  digitalWrite(ledPin1, LOW);

}
void oku() {

  //sensör 1 için
  int SensorValue = analogRead(sensor1);
  float SensorVolts = analogRead(sensor1) * 0.0048828125;
  float SensorYuzde = analogRead(sensor1) / 10;
  if (SensorYuzde >= 100) {
    SensorYuzde = 100;
  }
  Blynk.virtualWrite(V5, SensorYuzde);
  //sensor 2 için
  int SensorValue2 = analogRead(sensor2);
  float SensorVolts2 = analogRead(sensor2) * 0.0048828125;
  float SensorYuzde2 = analogRead(sensor2) / 10;
  if (SensorYuzde2 >= 100) {
    SensorYuzde2 = 100;
  }

  Blynk.virtualWrite(V6, SensorYuzde2);
  //sensor 3 için
  int SensorValue3 = analogRead(sensor3);
  float SensorVolts3 = analogRead(sensor3) * 0.0048828125;
  float SensorYuzde3 = analogRead(sensor3) / 10;
  if (SensorYuzde3 >= 100) {
    SensorYuzde3 = 100;
  }
  Blynk.virtualWrite(V2, SensorYuzde3);
  //sensor 4 için
  int SensorValue4 = analogRead(sensor4);
  float SensorVolts4 = analogRead(sensor4) * 0.0048828125;
  float SensorYuzde4 = analogRead(sensor4) / 10;
  if (SensorYuzde4 >= 100) {
    SensorYuzde4 = 100;

  }
  Blynk.virtualWrite(V1, SensorYuzde4);
  //sensor water için
  int SensorValue5 = analogRead(sensor5);
  float SensorVolts5 = analogRead(sensor5) * 0.0048828125;
  float SensorYuzde5 = analogRead(sensor5) / 10;
  if (SensorYuzde5 >= 100) {
    SensorYuzde5 = 100;
  }
  Blynk.virtualWrite(V4, SensorYuzde5);
  //sıcaklık için
  temp = analogRead(A5);
  int temperature = (temp * 500) / 1024;
  Blynk.virtualWrite(V3, temperature);


  lcd.setCursor(14, 2);
  lcd.print(SensorValue);
  lcd.setCursor(9, 3);
  lcd.print(SensorVolts);
  lcd.print(" V");

  //Nem yüksek seviye kontrolü 1
  if (SensorValue >= 800 && uyari == 0) {
    Blynk.notify("1. SIRANIN NEM SEVİYESİ %80 OLDU. VANA KAPANIYOR.");
    uyari = 1;
    vanaKapa();
  } else {
    if (SensorValue < 800) {
      uyari = 0;
    }

  }


  //  Nem yüksek seviye kontrolü 2
  if (SensorValue2 >= 800 && uyari1 == 0) {


    Blynk.notify("2. SIRANIN NEM SEVİYESİ %80 OLDU. VANA KAPANIYOR.");
    uyari1 = 1;
  } else {
    uyari1 = 0;
  }
  //Nem yüksek seviye kontrolü 3
  if (SensorValue3 >= 850 && uyari2 == 0) {


    Blynk.notify("3. SIRANIN NEM SEVİYESİ %80 OLDU. VANA KAPANIYOR.");
    uyari2 = 1;
  } else {
    uyari2 = 0;
  }
  //Nem yüksek seviye kontrolü 4
  if (SensorValue4 >= 850 && uyari3 == 0) {


    Blynk.notify("4. SIRANIN NEM SEVİYESİ %80 OLDU. VANA KAPANIYOR.");
    uyari3 = 1;
  } else {
    uyari3 = 0;
  }
  //Su deposu Kontrolü
  if (SensorValue5 <= 5 && uyari4 == 0) {
    Blynk.notify("Su deposunda su kalmadı.");
    uyari4 = 1;
  } else {
    uyari4 = 0;

  }

}


void setup()
{

  pinMode(ledPin1, OUTPUT);
  digitalWrite(ledPin1, ledPinState1);
  pinMode(ledPin2, OUTPUT);
  digitalWrite(ledPin2, ledPinState2);
  pinMode(ledPin3, OUTPUT);
  digitalWrite(ledPin3, ledPinState3);
  pinMode(ledPin4, OUTPUT);
  digitalWrite(ledPin4, ledPinState4);




  // set up the LCD's number of columns and rows:
  lcd.begin(20, 4);
  // Print a message to the LCD.
  lcd.setCursor(0, 2);
  lcd.print("Analog Value: ");
  lcd.setCursor(0, 3);
  lcd.print("Voltage: ");
  // Debug console
  SwSerial.begin(9600);
  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
  timer.setInterval(1000L, oku);
}

void loop() {
  Blynk.run();
  timer.run();



  /*

  */
}

im just trying the call a vanaKapa(); in here .

//Nem yüksek seviye kontrolü 1
  if (SensorValue >= 800 && uyari == 0) {
    Blynk.notify("1. SIRANIN NEM SEVİYESİ %80 OLDU. VANA KAPANIYOR.");
    uyari = 1;
    vanaKapa();
  } else {
    if (SensorValue < 800) {
      uyari = 0;
    }

  }

and the vanaKapa() is

void vanaKapa() {
  ledPinState1 = 0;
  Blynk.virtualWrite(vPin1, 0);
  digitalWrite(ledPin1, LOW);

}

What EXACTLY does this mean?
What “simulation” and what error?

Pete.

Its proteus simulation. The given error code says nothing and i could not find any solution. But when i disable the function vanaKapa() its working fine.

I just want to turning off my button which is v12 inside the if loop. Whenever i write Blynk.virutalWrite(v12)(or Vpin) the simulation stops.

What are you seeing on your SwSerial COM port?

Are you sure that it’s the Blynk.virtualWrite command in your vanaKapa function that’s causing this?

Pete.

On compim Port2 , blynk Port3 communication is fine.

Are you sure that it’s the Blynk.virtualWrite command in your vanaKapa function that’s causing this?

Not really. But when i delete Blynk.virtualWrite command its working fine. Thats why i wrote the all code if u see any conflict.

I’m not really sure what you mean by this, but the output from the debug serial port (SwSerial) should show valuable information about the Blynk connection status. What does this serial monitor show?

Pete.

Oh i see. Sorry for the misunderstand.I never used the serial monitor. When i checked Serial monitor it gives me just the token.

Well, if COM3 is actually mapped to SwSerial then you have a serious issue with your setup.

Pete.

Do you have any idea about the problem ? What should be seen on the monitor ?

No, I’ve never felt the need to use an emulator

The Blynk logo and information about the connection to the server and the IP address.

Pete.