I’m not really a hardware person. I can muddle my way through some basics, but it’s not my strong suit. I’m comfortable writing software, but sometimes you just want it to interface with physical objects. I find Arduino boards (and their clones) to be nice for that, mostly because of the variety of shields and sensors that can be had easily and inexpensively. Because wires, jumpers, screw terminals and the odd lot of simple, through hole soldering is about as far as I can go hardware-wise. You won’t catch me designing a PCB, and even assembling one that requires surface mount components is a stretch for me.

The Arduino IDE and tooling, and the not-quite-C++ environment you’re steered to by default, though, can be frustrating. Often as not, I find myself fighting connectivity issues and the like until I’ve expended my time box and put my project away, frustrated. I know you have always been able to use vanilla C or C++ on the devices, but never got my environment set up correctly for that.

Today while waiting out the snow delay, I ran across PlatformIO and decided to kick the tires. I think this solves most of my gripes about Arduino.

Here’s what I needed to do to get from zero to reading a potentiometer, playing a tune on a buzzer, and displaying text on a 16x2 LCD with an arduino uno:

  1. Install the VS Code extension. They seem to recommend this, and today was all about trying to see the happy path before I try to bend it to meet my workflow preferences.

  2. Try the blink demo in the GUI, work out some serial IO, find an I2C library that is decent for the LCD, muddle my way through some undocumented sensors and shields in my parts drawer.

  3. Make the command line tools accessible from my path, once it seemed to be working nicely.

  4. git init .

  5. mkdir device; cd device

  6. pio init -d . --ide vscode -b uno

  7. git submodule add https://github.com/thijse/Arduino-CmdMessenger.git lib/Arduino-CmdMessenger

  8. git submodule add https://github.com/johnrickman/LiquidCrystal_I2C.git lib/LiquidCrystal_I2C

  9. code .

With that, I have a scratch pad project ready to easily print messages to an LCD, send and recieve commands/responses over the serial bus, and use arduino affordances from vanilla C++. And the tooling seems pleasant and reliable.

And the kid who was waiting out the snow day with me got a real bang out of watching/helping me assemble stuff and seeing/hearing the result. I’m counting that a flawless victory for today.