I am NOT a JSON expert … and have some difficulties in trying to use the Arduino library on an Adafruit Feather to report real-time rocketry data including position. The documentation I have been able to find is not particularly helpful in this regard.
I had this working on a Particle Electron/Photon but seems to fail on the Feather.
How do I encode the variable for position (as a formatted string I believe) and transmit via the Arduino Ubidots Library to the server using the .add method?
Thanks!
Ken
Hello @KenBiba,
At the moment we doesn’t support the Adafruit Feather board.
You can read our API reference, and get an idea how to build a JSON object.
In your case, if you want to get the position, you should send a JSON object containing the “context” of the data point. For example:
‘{“variable”: {“value”:10, “context”:{“lat”:-6.2, “lng”:75.4}}}’
This is how you should have to build it.
Regards.
Maria C.
Hello @KenBiba,
The sendall() function is the one to which you should take a look, it constructs the JSON to be sent, for example, if you need to send a unique value in arduino you construct something like this:
client.println("{“var_label”:{“value”:1}}\r\n\n");
In the background, Arduino’s http library construct properly the JSON format dictionary.
Hope it helps you.