LCD Widget Display Value, gets untruncated

void Temperature()
{
  //You can send any value at any time.
  //Please don't send more that 10 values per second.
  //Read the Temp and Humidity from DHT
  
  float t = dht.readTemperature();
  String rt = String(t,1);
  int h = dht.readHumidity();

  Blynk.virtualWrite(11, rt); // virtual pin
  Blynk.virtualWrite(12, rt); // virtual pin
  Blynk.virtualWrite(13, h); // virtual pin
  Blynk.virtualWrite(14, h, "%"); // virtual pin
  Serial.println(t);

  // Please use timed events when LCD printintg in void loop to avoid sending too many commands
  // It will cause a FLOOD Error, and connection will be dropped
}

With this code, I store the temperature in Celcius to a String “rt” while truncating its decimal value to 1. Refer to the attached pictures here…







The widgets,

  1. Value Display, and
  2. LCD Widget, reads data from the same Virtual Pin…

But as you can see, they’re both not the same…
Value Display truncates the decimal points, as intended
LCD Widget displays a different data altogether…

For example:
Value Display Widget shows, 17.8
LCD Widget shows, 17.799999

Also, the LCD Widget truncates the value near a whole number like “32”
Also, it truncates the value near “.5”, like “32.5”

Can we get this fixed in the next update?

Hello. Yes, at the moment you have to format number by yourself. We will try to improve that in future.

Hi Dmitriy,
I did format the number as you mentioned with code

String rt = String(t,1);

This code should format the number… 32.599998 will be converted to 32.5
Also serial monitor shows formatted number, 32.5. But LCD Widget shows 32.599998. It’s already converted to a string, and I don’t know, from where does the LCD Widget get this number with 6 decimal points?

Edit. Ignore me. Sorry