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);
Pavlo
June 20, 2018, 6:51pm
3
Try converting to variable and then pushing this variable to Pin
I don’t quite understand… they are all variables?
I think that what @Pavlo 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.
This just means you’re using old Arduno Core. Please update