virtualWrite Float to Blynk results in Zeros

When using

 Blynk.virtualWrite(1, bv.toFloat()); 

The Labelled Value Widget on V1 displays “0.00”

However when using Serial.println(bv.toFloat()); , the correct value of 4.16 is displayed in Serial Monitor.

Relevant code:

  int sensorValue = analogRead(A0);
  float volt = sensorValue / 1023.0 * 3.3;
  float batvolt = (volt * 13200 / 10200.0 * 1.065) - 0.03;
  float perc = (batvolt - 3) / 1.2 * 100;
  String bv = String(batvolt);
  Serial.println(bv.toFloat());
  Blynk.virtualWrite(1, bv.toFloat());

Same outcome when using Blynk.virtualWrite(1, bv.toFloat()); or Blynk.virtualWrite(1, batvolt);

Try converting to variable and then pushing this variable to Pin

I don’t quite understand… they are all variables?

I think that what @Pavel means is this…

x = bv.toFloat();
Blynk.virtualWrite(1, x);

Pete.

Oh I see, however I have used Blynk.virtualWrite(1, batvolt); with batvolt being a float variable, to no avail. Sending int and String however cause no problems.

I have just seen this post Blynk Library v0.5.3 regression: ESP8266 floating point issue … might explain a lot. Thanks for the help @PeteKnight

This just means you’re using old Arduno Core. Please update