Sometimes you need to get a project to talk to you, so you can see what’s going on inside. The ESP32 console Arduino library from [jbtronics] promises just that.
The library adds a simple serial console to the ESP32, and is compatible with the Arduino ecosystem to boot. It’s set up to allow the easy addition of custom commands so you can tweak the console to suit your own projects. It’s remarkably complete with nifty features, too. There’s autocomplete as well as a navigable command history – the sorts of features you only expect from a modern OS terminal. A bunch of system commands are built-in, too, for checking the status of things like the memory, network interface, and so on.
The tool is available via the Arduino library manager or the PlatformIO registry. You’ll want to use it with a VT-100 compatible terminal like PuTTY or similar, which lets you use all the fancy features including color output. [jbtronics] hopes to port it to the ESP8266 soon, too!
We’ve seen some other great serial tools of late, too. If you’re brewing up your own nifty console hacks, be sure to drop us a line!
Just to clarify, this is not really new to the ESP32 – this project simply encapsulates the (very nice) Console component from the ESP-IDF so that it can be used from the Arduino environment.
I strongly advise to use the ESP-IDF directly, it is much more powerful than the Arduino environment.
If you use micropython I think you can just use the input function to accept a string from the console, then the eval function to run whatever line of code is submitted. You can instantly run any function directly. No need to parse every command or whatever. You can even run whatever line of python code you want, stuff you hadn’t thought you might want, print any variable you want, check data types, whatever.
Obviously this approach would have massive security implications, but assuming that’s not an issue for you.
And much the same with Forth – you get a full command console and programming language. If you need remote commands, then it’s likely a better choice than writing any kind of command interpreter and macro language. You don’t need to be actually writing your program in Forth. It is a much lighter addition than uPython.
@. said: “And much the same with Forth – you get a full command console and programming language. If you need remote commands, then it’s likely a better choice than writing any kind of command interpreter and macro language. You don’t need to be actually writing your program in Forth. It is a much lighter addition than uPython.”
Esp32forth [1] is faster and lighter than Micro/Circuitpython.
1. Esp32forth
https://esp32forth.forth2020.org/home
You have a site with a lot of documentation and lots of programming examples in FORTH for ESP32forth:
https://esp32.arduino-forth.com/
Does this work over WiFi?
it’s funny, I did some weeks ago a similar console but with some WiFi primitives and also you can extend it with custom commands:
https://github.com/hpsaturn/esp32-wifi-cli/
In our ESP32 Wrover based squeezelite player, we use the ESP-IDF console component and allow serial, wifi or both.
https://github.com/sle118/squeezelite-esp32/tree/master-cmake/components/telnet