Please let me share μcuREST library which is aimed for easy creation of RESTful and/or JSON-RPC API in IoT projects.
The concept of this library is described on this page. In short words - you define a map of URIs to application’s variables/functions and μcuREST makes them accessible via HTTP protocol.
The ZIP with the library sources packaged for Spark Particle SDK is available for downloading from GitHub. Just unzip in in the SDK’s top directory and it will create user/libraries/micurest with the library sources, user/applications/micurest_snip and user/applications/micurest_demo with a simple example and more advanced demo application. The demo is also available as prebuilt binary on this link.
Library sources are hosted on GitHub as well https://github.com/hutorny/micurest
Below you may find some screenshots made from the demo application.
ps, i had flashed my photon with your binary, but it wasn’t accessible when I went to what I understand (from the router’s MAC table) is the photon. ie 192.168.0.190/demo
Changing Serial1 to Serial and will see what it thinks is going on!
In file included from applications/micurest_snip/micurest/access_log.hpp:21:0,
from applications/micurest_snip/application.cpp:9: applications/micurest_snip/micurest/miculog.hpp:86:54: error: 'enabled' function uses 'auto' type specifier without trailing return type
static inline constexpr const auto enabled(level lvl) {
Seems to error close to the end. Will re-run it with 4.9.1
/Users/markterrill/opt/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: ../build/target/bootloader/platform-6-lto/bootloader.elf section .text' will not fit in region APP_FLASH'
/Users/markterrill/opt/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region APP_FLASH' overflowed by 3348 bytes /Users/markterrill/opt/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-sbrkr.o): In function _sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2: error: ld returned 1 exit status
make[1]: *** [../build/target/bootloader/platform-6-lto/bootloader.elf] Error 1
It doesn’t do that error if using gcc 4.9.1, however pulls up a range of template errors to do with ‘micurest::network_spark_socket::tcp::tcp’ (the tcp::tcp seems not to match the template in the .ccs:
@hutorny, could you try compiling again locally? I’m swimming a bit further than my normal depth. Changing the reference to avoid the double tcp::tcp didn’t work out. It seems since the last time you compiled that a fair few things have moved quietly in the night that you probably could fix up quickly.
Simply included the pinmap_hal as it has the system wide define for total_analog_pins, whereas strangely digital_pins isn’t defined so simply put in a define.
Awesome library, its like the tinker app but over local HTTP which addresses so many use cases when the user doesn’t have internet.
I’ve updated my SDK to the official release/stable and confirm the issue. It looks like application.h does not include Arduino.h anymore. With inclusion of it, issue with NUM_DIGITAL_PINS and LED_BUILTIN is gone
You can follow this issue on github but my understanding is that adding Arduino.h to application.h caused a lot a libraries to fail to compile due to multiply defined Arduino symbols. So they decided to change it in a way that lets library authors control which level of compatibility they want.