Using PyFirmata to rewrite an Arduino sketch

I’ve had an Arduino for almost 8 years now; I got it as a birthday present from my Dad. And boy, I’ve gotten a lot of use out of the thing. From a makeshift oscilloscope to a quick-and-dirty ESP8266 programmer , the Arduino has served me well. However, as I’ve learned more tools and languages, I began to find the base Arduino Sketch language (henceforth referred to as “Sketch(es)”, with a capitol ‘S’) kinda…clunky. Arduino should be all about banging out quick prototypes that work. Python is basically pseudocode already, so why waste time thinking about all those convoluted bytes and types and curly-braces, when you can start digging into the deeply troubling bugs in your project-design, rather than mess with the language. You know, really get in the zone.

Read More

Exploring Perlin Noise in Python

First of all, I would like to say that the code in this post was inspired by Adrian Biagioli’s article on Perlin Noise, which can be found here. That being said, this really isn’t going to be a primer on Perlin Noise itself, rather it’s going to focus on its implementation in Python. First, a recap of the converted C++ code from Adrian’s article:

Read More

Compile-time constants with Pyinstaller spec files

When I was developing LIFX-Control-Panel, I was constantly running into the problem of keeping my version numbers straight. Namely, I was keeping my version number in two separate places; one in the top of my settings.py file, and the other in the default.ini config file. The idea was, the binary would compare its version string to config.inis on startup, and if the binaries version was greater than the existing config, it overwrite it with the newer default.ini. A brilliant, game-changing idea on it’s own (if I do say so myself), but the problem was, I had to manually set the values every time I upped the version number or rebuilt the binaries. Naturally, I forgot to keep the version numbers in lock-step, and much confusion ensued. How could I keep these constant values in some singular place, where I only have to change them once and it will propagate through the rest of my code?

Read More