Lightweight HTML/CSS front-end for microcontroller projects #9787
DavesCodeMusings
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is not MicroPython per se, but can be used to put a nice web-based control panel on your MicroPython projects. I've been using it to interact with a MicroPython API I built, so I thought I'd share it here if others are interested.
What is it?
If a picture's worth 1000 words, a demo has got to be worth at least ten times that, right? So here is the link where you can see it:
https://davescodemusings.github.io/spartan/
What you'll get is:
Ideally, you would create functions that call a back-end API to gather values you want to display.
For example, this bit of code creates a function to return the current brightness of a pulse-width modulated LED:
When this is in a file called index.html, visiting the URL
http://server/index.html#brightness
will execute the route function and the current brightness will be displayed in the element with an ID of content.For example:
A more complete example can be found here: https://github.com/DavesCodeMusings/spartan/blob/main/docs/index.html
Advantages
Potential Drawbacks
Where to find out more...
If you made it this far and you're still interested, the project is called Spartan and can be found on GitHub at:
https://github.com/DavesCodeMusings/spartan
For the code used to supply the back-end API, I'm using my own MicroPython web framework called Thimble:
https://github.com/DavesCodeMusings/thimble
With the Thimble project, there's an example API to control the built-in LED on an D1-mini that can be used to supply the backend for experimenting with Spartan:
https://github.com/DavesCodeMusings/thimble/tree/main/examples/pwm-led-api
Beta Was this translation helpful? Give feedback.
All reactions