Thursday, January 1, 2015

cloudClock: ArduinoJson or python json

I am planning on having all data from the cloudClock stored in files in json format, so I looked for a json library for arduino. I found ArduinoJson, downloaded it, imported the library in the arduino 1.5 IDE and... not working... it complained about missing core-dependencies. Some research and I found the file:
~/Arduino/libraries/ArduinoJson/library.properties

Which has the following content:

name=ArduinoJson
version=4.0
author=Benoit Blanchon <http://blog.benoitblanchon.fr/>
maintainer=Benoit Blanchon <http://blog.benoitblanchon.fr/>
sentence=An efficient and elegant JSON library for Arduino
paragraph=Supports JSON parsing and formatting. Uses fixed memory allocation.
url=https://github.com/bblanchon/ArduinoJson
architectures=*

I had to add the lines in red bellow to the file to get the library to work in the arduino 1.5 IDE:

name=ArduinoJson
version=4.0
author=Benoit Blanchon <http://blog.benoitblanchon.fr/>
maintainer=Benoit Blanchon <http://blog.benoitblanchon.fr/>
sentence=An efficient and elegant JSON library for Arduino
paragraph=Supports JSON parsing and formatting. Uses fixed memory allocation.
url=https://github.com/bblanchon/ArduinoJson
architectures=*
core-dependencies=
dependencies=
email=

After much thought I decided to leave the responsibility of parsing json to python scripts running on the linino side, so that arduino would just call the python script and read its stdout. I will be uploading my scripts to github at some point.