I would like to realize a system that permits me to log data a display graphics of environmental sensors connected to the Core.
I was thinking to Xively, since it seems pretty easy to be used instead of developing a personal solution.
I was looking to this tutorial, https://xively.com/dev/tutorials/arduino_wi-fi/ does anyone already tried to adapt this to the Core?
Any suggestion on how to port this?
Thank you,
dk
Unfortunately I had some issue using the serial output and flashing the core, so I used ledStatus connecting a led to pin D0.
I don’t know if I have used the functions TCPClient functions correctly so please feel free to review and make corrections or improvements of the code below. If you have further ideas or better ways to connect to xively please feel free to suggest as well.
The code seems to work… I have noticed that each 4, 5 iterations the core starts blinking green, blinking blue, than gets the connection again and everything continues (the i counter does not start from 0).
thank you! I have been playing around trying to get this to work with HTML but haven’t had any luck.
This code works for me but it seems to cause the spark core to freeze up. Every so often it will go from cyan to flashing green and then back to cyan but when it does this the program stops and won’t start again until the core is reset. Anyone have any ideas about that?
never mind figured it out. It was the long loop time causing it to hang. replacing the delay(5000); with a check against millis() seems to have fixed it.
The code seems to work on my Spark, I’ve got the blinking LEd and everything but no data in Xively. One thing I find surprising os the port you connect to 8081… Shouldn’t you be connecting with SSL through 443? (which I don’t know how to do)
Thanks
Update: Apparently the Spark Core cannot handle HTTPS requests so you need to use an intermediary. That said the 8081 port is strange… should work on port 80 though.
Update2: Definitely no data is going into anything in Xively… hard to debug. Any tips? Would you be able to post your entire code? I’ve solve the hanging issue as well - that’s a nasty bug…
Hi, the code is based on the information found on the Xively knowledge base.
The port is the one reported here http://xively.com/dev/docs/api/communicating/sockets/.
Make sure the you have placed the correct FEED_ID and XIVELY_API_KEY and make sure you changed the label of datastreams with the name you used in:
client.print(" “id” : “Humidity”,");
and
client.print(" “id” : “Temperature”,");
I suggest as well to reduce all the “delay” under 2000 otherwise it will stuck.
Let me know if it works for you.