And why context managers are your friends

In the 2020 StackOverflow Annual Developer Survey, Python was the #1 most wanted programming language. It’s easy to see why: Python is easy to learn, easier to read, and it allows programmers to articulate complex instructions with very simple syntax. Python is used all over the place: web development, machine learning, data science, even on embedded systems. (Check out MicroPython!) Python can also be used to interact with hardware devices. With the increasing popularity of single-board computers with IO pins exposed (like the Raspberry Pi), low-level development has never been more accessible to entry-level coders.

Hardware programming poses some interesting…

Interact with I2C, SPI, or bit-bang hardware using the FTDI FT2232H Mini module in Python3 and test it with an Arduino!

Sometimes you’ll find yourself needing to bridge the gap between your PC and a low-level hardware device like a microcontroller or an FPGA. These devices usually “speak” in protocols like I2C and SPI, but you might even need to read and write bits (aka “bit-bang”) in some situations. Some ADC converters are configured via I2C, but the actual data is returned as sets of 8-bit words.

You might be tempted to deploy another microcontroller (like an Arduino) that has…

Ben Gillett

Software engineer, hardware hacker, musician, maker! Will program for pretzels.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store