I made a physical button to deploy production and regret nothing.
Over the last few weeks I’ve been looking for a project.
I currently work for a python shop and have really taken a liking to it. Simultaneously, I keep seeing new hardware supporting micropython. I’m not against the C’ish language that the arduino type stuff pushes for, but it’s nice to get the best of both worlds: an abstracted language with nice syntax and the ability to do dumb stuff with voltage. So: I did just that.
The Controller
I’ve really wanted to play with the ESP8266 after seeing some cool projects cross over my feeds. I decided also to kill two birds with one stone and try the Huzzah board from adafruit that includes onboard wifi because I hate money. The board itself was fantastic out of the box.
The Learning Curve
Without doing any whatsoever much research my brain really thought that micropython was going to be a “drop in replacement” for the UX of programming a board in the arduino IDE. It’s not. This is actually my biggest complaint about micropython. The code itself was very very very straightforward. Write a main.py
that does your stuff, and profit. You can load libraries that support micropython, etc.
Getting there? Meh.
First: you have to flash your esp with the micropython firmware.
Next: you have to get your code onto the board. The feedback loop for this is the annoying part. The first time you flash the firmware you have to enable WebREPL. It’s a one-time cost but it’s smelly. This enables a wifi broadcast from the board that you can then access from webrepl with a password.
If you make it past the previous step you can make main.py
join your wireless network (note: 5ghz is not supported) with something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Now that it’s on the network you can use webrepl to the local address of the huzzah. But it still sucks compared to the typical UX of: select board, click compile.
What You Came To See
If you’re still reading I’m sure you want to see what I did. Basically I took 4 mechanical keyboard switches (I have a lot OK?!), wired them to the huzzah, and made it send a slack command to our internal slack bot to force deploy production (ignore all locks, send a message to yours truly).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
It works and it’s pretty empowering to smash. We deployed to production a record number of times that day.