If I format values like this the label widget no longer changes colour based on the rules defined in the template.
Blynk.virtualWrite(V17, String(vivTemp, 1));
If I format values like this the label widget no longer changes colour based on the rules defined in the template.
Blynk.virtualWrite(V17, String(vivTemp, 1));
Is this a String data type for your data stream?
If so, I can’t see this working
You have an overlap with 15 appearing in two ranges. Also, you may want to do things like 0-14.9 15-19.9 etc.
Pete.
Hi Pete,
I’ve fixed the range, it seems to take the lowest range value when colouring.
I’m converting the float value to a string so that padded zeros are included on the label, is there a better way?
Use a float data type and select the number of zeros in the datastream setup.
Pete.
Peter is right. It seems like you have a String datastream. Should be int or float.
I still have the problem with float data type, any idea?
At 26.8C it has no colour but 27C is correct.
float vivTemp = 0.0;
Did you try this?
At the moment you’re saying that it should be green up to 26.0 and yellow from 27.0
Your value of 26.8 is between these two rules.
Pete.
Hi Pete, it doesn’t accept decimals unfortunately.
How odd! I’ll try again…
Fixed - I was testing if decimals were possible using .0, which is removed by the interface. Any valid number 1-9 works.
And does that solve the colour coding issue?
Pete.