Decimals not appear at Vera UI
-
Hello , I am modifying files multimeter to work well in UI7 , so far work well , but can not get me decimals appear in the interface vera ( in arduino if displayed) , only the first number , for example appears .
Sketch
gw.send ( msgVoltBat.set ( ( int ) VoltLevelBat , 2) , 1) ;
sends 3.95 volts and appears vera UI 3.00
I tried to change the type of variavle in S_Multimeter1 to i4 , UI4 , string , float without results.
Use this skit to control the voltage of the battery and solar module and need to be accurate.
Thank you very much
-
@rabeliyo said:
VoltLevelBat must be a float (or casted to a float) when calling set.
-
ok!! Like this?
float VoltBatScale = analogRead(A2);
float VoltLevelBat = VoltBatScale*4.12/376; //376 is the analog read at 4.12v (full charged battery)
if (VoltLevelBat != lastVoltLevelBat) {
gw.send(msgVoltBat.set((float)VoltLevelBat,2),1);
lastVoltLevelBat = VoltLevelBat;
-
yes, but you shouldn't need to cast a float to a float like you are doing here:
gw.send(msgVoltBat.set((float)VoltLevelBat,2),1);
also, because of the way floating point numbers work:
if (VoltLevelBat != lastVoltLevelBat) {
may be a LOT more frequently than you may actually wish. Consider just updating the controller with a simple timer instead.
-
Works!!! Thanks a lot, i upload my remake of multimeter for UI7, all works but i only use the current and the voltage for my solar module, i will change the impedance to Kw/h
Vera Files:
http://www51.zippyshare.com/v/fk2Ay5ww/file.htmlNow i have a problem with the 3.3 PIR mod, i open a new post XD
Suggested Topics
-
Library Compatabilty under Vera UI7
Vera • 23 Feb 2020, 23:34 • mntlvr 18 Mar 2020, 17:07 -
Icon Location Offline
Vera • 2 Jan 2021, 03:51 • marknmel 2 Jan 2021, 03:51 -
Vera Edge pi v1 ethernet gateway
Vera • 7 Dec 2019, 13:56 • urbanus 18 Dec 2019, 07:04 -
Create a listening port for http sensor posts ?
Vera • 24 Jul 2021, 09:10 • nodecentral 24 Jul 2021, 09:10 -
OpenLoop Noob, need to know if what I want to do is possible
Vera • 14 Apr 2020, 17:30 • tamorgen 2 Jan 2021, 14:14