Help sending payload with more decimal places
-
Hey guys,
Just wondering if someone would be so kind as to help me figure out how to use setters to send a payload with more decimal places than the standard custom variable.
I saw that perhaps I could construct the msg "on the fly", but I don't know the proper syntax to get that accomplished. Even easier, I would simply like to send a custom variable with two decimal places (or however many one should like). Right now the default is a single decimal place as I gather from the data that is being sent currently.
In the plainest terms, I would like to send the battery voltage in a format X.XX using a custom variable, but using the standard custom variable constructor the payload is X.X.
Thanks for your help.
-
@hek okay, I guess I was being stupid....
With this msg constructor...
MyMessage msgVolt(CHILD_ID_VOLT, V_VAR1);With this type def...
float batteryV = sensorValue * 0.003363075;I had the following thinking that I had turned on auto ack...
gw.send(msgVolt.set(batteryV, 1));but that sets the decimal places to "1". So, if I want to set the decimal places to "2" and enable auto ack it would look like this...?
gw.send(msgVolt.set(batteryV, 2),1);Thanks again.
-
@hek okay, I guess I was being stupid....
With this msg constructor...
MyMessage msgVolt(CHILD_ID_VOLT, V_VAR1);With this type def...
float batteryV = sensorValue * 0.003363075;I had the following thinking that I had turned on auto ack...
gw.send(msgVolt.set(batteryV, 1));but that sets the decimal places to "1". So, if I want to set the decimal places to "2" and enable auto ack it would look like this...?
gw.send(msgVolt.set(batteryV, 2),1);Thanks again.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login