Programming Arduino with Atom
Working with Arduino’s is a lot of fun. Getting started is super easy thanks to the provided IDE and lots of great example code:
After getting past the “Hello World” phase I started to miss the editor experience that other editors give me, simple things like the ability to copy a line without highlighting or the way files are managed.
I found a whole list of development tools on the Arduino website. Two that stood out to me are:
- The Viper IDE - Allows you to program the Arduino in Python on a web based IDE, neat!
- Visual Studio Arduino Plugin - This looks really cool and thanks to Visual Studio Community is free to get started with.
Since for now I want to stick with C++ and the kids I’m teaching use Linux laptops, both of the above tools I found were not going to work.
We were already successfully programming Python and Javascript with Atom on the Linux laptops, so I decided to look for a way to program the Arduino with Atom.
The most promising extension I came across for Atom is platformio. Here is a blog post from the creator that explains what platformio is. See here for a list of the other Atom Extensions I use.
Platformio has a nice some pretty easy setup instructions:
I only ran into two issues trying to install the extension on my Mac.
-
I got an error “option –single-version-externally-managed not recognized” when trying to install Platformio.
There is an issue report here with a ton of info.
I fixed the issue by adding “–egg” to the install command (which someone in the above issue report said was a bad idea, but it worked for me…)
-
I use virtualenv to isolate all of my Python environments. When I tried to build from Atom I got an error about not being able to find Platformio because I installed Platformio in a virtualenv.
Luckily the platformio extension allows you to enter a custom path in the settings.
To fix the issue I did the following:- Open a terminal and enter your virtualenv using workon
- Type Echo $PATH.
- Copy the path string and paste into the settings of the platformio extension:
- Open a terminal and enter your virtualenv using workon
Once the above issues were completed I was able to build and then upload a sample program to my Arduino!