in Automation, Electronic, Life&Travels, Programming

Flashing 8266 with keyboard maestro

Okay, as many of my firends know I’m playing with IoT controllers, Arduino, NodeMcu, etc. and one of the most frequent things to do with 8266 is flashing firmware to enable different languages or install different software.

To do that you have to use the terminal and specify each time the port to which is attached the 8266 and the name of the firmware you want to flash.

Nothing too complicated or too much time consuming, but why not automate it with Keyboard Maestro?

The idea

The idea is simple: I want a macro that let’s me select all ports available and all firmware available in a folder and composes the command line for me.

To detect available ports is pretty easy on OsX, and for our purpose is sufficient to list everything like ‘/dev/cu.*’.

Let’s look at the macro

Ok, so let’s have a look at the final product:


You can see an input mask with two drop-downs, one for choosing the port to which 8266 is connected, and the other to choose the firmware to flash.

To do that I wrote two actions that run a Python script and return the contents of two directory (/dev/cu.* and /Users/gianx/Downloads/NodeMCU/firmware/), rapresented by a list of values separated by the ‘|’ (pipe) character.

Both the results are saved in twho variables and ready to be used later.


Now, the second trick is how to display drop-downs based on variable contents: to do that you just have to enter as a default value for a file ‘|%Variable%[variablebname]%’, where [variablename] is a list of pipe separated values.


And voilà…

The final macro has a couple of instrucions more, and if you want you can download i here.