Python program to automatically create arduino webserver from folder. Supports basically all file types. For example: html, js, css, images, and arbitrary binaries. Also supports coding cpp functions inside the website files (see input/*.cpp) for example.
$ sudo pip install webduino-generator
The following will build the demo website included in this repository.
$ git clone https://github.com/StoneLabs/webduino-generator
$ cd webduino-generator/
$ wgen generate input
$ wgen open
Or compile and upload directly (requires arduino-cli to be installed)
$ wgen compile
$ wgen upload
Aside from build a random folder you can create a project. By default a simple hello world program will be created.
$ wgen init
$ wgen build
$ wgen open
At the moment the templates only support WiFiNina based connections. Tested only on Arduino nano 33 iot. Should be fairly easy to adapt the templates for ethernet based devices though.
$ wgen init
$ nano templates/main.ino
The inputs files do not support loop() or init() code (as you might have seen from the example in this repository). However it is quite trivial to add code to loop() or init(). To do this simply edit the template generated with your project.
$ wgen init
$ nano templates/main.ino
$ wgen build
And compile and upload directly (requires arduino-cli to be installed)
$ wgen compile
$ wgen upload
Aside from wgen compile
and wgen upload
all commands should work regardless of your operating system. Even compile and upload should work if you manage to install arduino-cli
on windows. However, this is not tested.
I highly recommend not using includes inside input .cpp files. The cpp input files are packed in a namespace during the build. Importing inside the namespace might cause large sketches. The same goes for global variables shared between input files. However, it is quite simple to work around this. Simply edit the template as described above.
Not yet. Might use github wiki at some point.
Project is WIP.