Hi,
Context : ESP8266 Arduino, posting sensor data to a feed.
Issue : I succeed to post int values to a feed (with command MyTestFeed.send(x), x being an integer); but as soon as I try to execute the same command with x being a float, it fails to write x to the feed.
Can we only post interger to Adafruit IO ? If not, what do I have to change to post a number (a float) like "21.35" ?
How to post a float value to a feed ?
Moderators: adafruit_support_bill, adafruit
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
- clemens
- Posts: 41
- Joined: Fri Jan 06, 2012 12:21 am
- huguescmoi
- Posts: 13
- Joined: Sat Jan 23, 2016 12:29 pm
Re: How to post a float value to a feed ?
I do not see any solution in this other forum topic you are pointing to, only confirmation of the problem. Concretely what and where is the patch they are mentionning ?clemens wrote:see viewtopic.php?f=56&t=87611&p=441930
- clemens
- Posts: 41
- Joined: Fri Jan 06, 2012 12:21 am
Re: How to post a float value to a feed ?
viewtopic.php?f=56&t=87611&p=441930#p441189
I've found a workaround. Using dtostrf on it and posting the string works :).
- huguescmoi
- Posts: 13
- Joined: Sat Jan 23, 2016 12:29 pm
Re: How to post a float value to a feed ?
Thx.
However this command converts a float into a string. Isn't that a problem for IO Adafruit to draw charts requiring number values and not strings ? It does not seem very logical...
However this command converts a float into a string. Isn't that a problem for IO Adafruit to draw charts requiring number values and not strings ? It does not seem very logical...
- clemens
- Posts: 41
- Joined: Fri Jan 06, 2012 12:21 am
Re: How to post a float value to a feed ?
In my setup it is working well, and the string / char definition is on the Arduino side only. So the Adafruit IO gets only some json or whatever stuff and no information that the variable is a char!
Nevertheless yes, that's a bit funny but not so unique. It's necessary for some other payloads also, e.g. the RFM69 lib expects also char as payload.
Nevertheless yes, that's a bit funny but not so unique. It's necessary for some other payloads also, e.g. the RFM69 lib expects also char as payload.
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.