Error: 'class BlynkWifi' has no member named 'virtualRead'; did you mean 'virtualWrite'?

[Screenshot of code removed by moderator]

error: ‘class BlynkWifi’ has no member named ‘virtualRead’; did you mean ‘virtualWrite’?
int immersionTimerValue = Blynk.virtualRead(IMMERSION_TIMER_PIN).asInt();

error: ‘class BlynkWifi’ has no member named ‘virtualRead’; did you mean ‘virtualWrite’?
int submergeTimerValue = Blynk.virtualRead(SUBMERGE_TIMER_PIN).asInt();

I have error in my coding. In Blynk libraries, the correct function to use for reading a virtual pin is generally Blynk.virtualRead() . My library is the latest. Can someone help me. What should i do and change my coding?

When you post code please copy the text from your IDE and post it with triple backticks at the beginning and end, as explained/demonstrated when you create a new “need help…” topic.

Do the same when posting compiler errors and serial monitor output.

The reason for your compiler error message is that Blynk.virtualRead() is not supported in Blynk IoT. It was supported in Blynk Legacy (now discontinued), but it served no real purpose.

You should use the BLYNK_WRITE(Vpin) function to automatically obtain virtual pin state changes as they happen.
More info in the documentation.

Pete.

Thank you for replying me sir. I am sorry about the triple backticks.

void checkImmersionTimer() {
  if (isImmersionRunning) {
    i**nt immersionTimerValue = BLYNK_WRITE(IMMERSION_TIMER_PIN);**
    static int immersionTimeElapsed = 0;

    if (immersionTimeElapsed < immersionTimerValue) {
      immersionTimeElapsed++;
    } else {
      immersionTimeElapsed = 0;
      isImmersionRunning = false;

      digitalWrite(INLET_PUMP_PIN, LOW); // Turn off inlet pump
      Blynk.virtualWrite(IMMERSION_COMPLETE_LED_PIN, HIGH);
    }
  }
}

void checkSubmergeTimer() {
  if (isSubmergeRunning) {
    **int submergeTimerValue = BLYNK_WRITE(SUBMERGE_TIMER_PIN);**
    static int submergeTimeElapsed = 0;

    if (submergeTimeElapsed < submergeTimerValue) {
      submergeTimeElapsed++;
    } else {
      submergeTimeElapsed = 0;
      isSubmergeRunning = false;

      digitalWrite(OUTLET_PUMP_PIN, LOW); // Turn off outlet pump
      Blynk.virtualWrite(SUBMERGE_COMPLETE_LED_PIN, HIGH);
    }
  }
}

I already adjust the coding. About BLYNK_WRITE(Vpin), do you mean i should change like that sir?

Posting snippets of code isn’t very useful, especially when you don’t have any explanation of what you’re trying to achieve with your project, or any in-code comments that help us to understand.

You’ve said…

but the code you’ve posted doesn’t contain any BLYNK_WRITE(Vpin) functions, so it’s difficult to say whether the code will achieve whatever it is that you’re expecting it to.

Pete.

Hi. There are more accurately you can use functions

Blynk.syncVirtual(V0);

Blynk.syncVirtual(V0) would cause the server to send the latest value for datastream V0, causing the BLYNK_WRITE(V0) callback function to be triggered (if it exists within the sketch).

As I pointed-out to @Taki earlier…

without this BLYNK_WRITE() function in the sketch, calling Blynk.syncVirtual() will have no effect.

Pete.