JS library rounds values for Value Display

For example using: v1.write(‘0.999’); --> it prints “1” on the Value Display
using v1.write(‘test’); --> prints “test”
using v1.write(‘0.009’); --> prints “0.01”

It’s weird that it is rounding the string value.

I don’t think this issue has as much to do with Blynk as it does with how JS handles values… thus I changed your topic description.

Blynk tends to use Strings for all vPin data, whereas I think JS uses something different as a common variable type… still learning :stuck_out_tongue:




I’m sending a string, and I checked the JS library and it is not doing anything weird so the string shouldn’t be rounded. Probably is on server/app side.

There is not a common variable type :slight_smile:
THere are numbers, strings, objects,…and so on.

Apparently for numbers there is (for JS as I mentioned)…

As per one of the links above…

Yeah, the types are: number, string, object, boolean, array,…
And I’m sending a string, so it’s weird to have it rounded.
And the JS library seems to just concatenate an array not manipulating the input (my string), so I suspect it is on server/app side.

Well I just tested this and am getting expected results… so I suspect something else, perhaps in your code?

var testdisp = new blynk.VirtualPin(21);  // Setup Display Widget


I’m not using a labeled value…but the simple value.

There, you solved your own issue :stuck_out_tongue_winking_eye:

I use Labeled Displays for everything as they offer more flexibility and no disadvantages that I have found (well, I use Local Server so energy is not a factor… so there is that :slight_smile: ).

I don’t think it’s my issue :slight_smile:
Why the value display rounds the value? I think it is an issue actually.

I meant you have a solution that makes sense… the Labeled Display is meant for more complex data values.

There was that whole decimal point issue earlier, that may be related to the basic Display widget. I switched your topic type back and we will have to await a developer.

Ok, I have a solution, but I think this should be marked as issue, since I see no motivation in “value display widget” rounding the values :wink:

See my post above :wink:

1 Like