Embedded web server
One of the first examples found online that I was eager to try was a web server with Wi-Fi. I don’t even want to think about implementing this in C++. The solution with the Espruino is similar to a Node.js implementation, so it takes about 20 lines of code. For the Wi-Fi module, I used the famous ESP8266, which is supported by Espruino through a dedicated Node.js-like module.
As hello.JS was approaching, I decided to organize a small workshop to see how people with a web programming background would interact with the platform. The experiment was a success, and anybody managed to get the onboard LEDs to blink in no time.
I also showed the platform to our visitors at Evozon Open Day, where I prepared a traffic lights state machine as a demo project. Some of them were interested to see what was under the hood so I gave them a link to my GitHub repository.
You can also see it in action here:
Writing asynchronous code
Although the platform has a few bugs, it was a great experience for me to experiment with this platform. Switching to another paradigm is also a great learning experience. In my case, the event-driven, asynchronous code for the Espruino was nothing like what I’ve seen before (in C++), but I realized how things worked and I didn’t let the callback hell bite me.
Article written by Stelian Saracut