Basic Web Skeleton (LTS)
This is a copy of the Basic_WebSkeletonApp from the Sming LTS branch, modified to build for Sming 4.0. Sming uses ArduinoJson version 6 by default, so this sample demonstrates how to continue using version 5.
This is how it was done:
When including SmingCore.h, just use #include <SmingCore.h>.
Remove the file include/user_config.h. Sming provides this by default, but if you have made changes for your project then remove everything except your changes, but be sure to add #include_next <user_config.h> at the top.
Remove any #include <user_config.h> statements from your files. This file is automatically included by Sming.
Rename Makefile-user.mk file to component.mk.
Replace the file Makefile with the one from the Basic_Blink sample project. If you’ve ignored the instructions and modified the file (!) then you’ll need to move those changes into your new component.mk file instead.
Sming uses #pragma once style for header guards, so consider updating your own files if you’re not already doing this.
We use the OneWire Arduino Library, so add ARDUINO_LIBRARIES := OneWire to our component.mk file. Sming now only builds libraries which are specifically requested for a project.
We’re using ArduinoJson, version 6. Sming supports version 5 or 6, but you must specify which one:
Add ARDUINO_LIBRARIES=ArduinoJson6 to the project’s component.mk file.
Add #include <JsonObjectStream.h>. If you’re not using the stream class, add #include <ArduinoJson6.h> to code.
Update callback function parameter lists for
STAGotIP. We can also get a description for disconnection reasons, so display that instead of just a number. See Sming/Platform/WifiEvents.h.
In webserver.cpp, the onConfiguration() function uses request.getBody(). It is more efficient to use streams, so just replace with request.getBodyStream().