Atomic Arduino (and Other) Development

Even the most die-hard Arduino fan boys have to admit that the Arduino development environment isn’t the world’s greatest text editor (they’d probably argue that its simplicity is its strength, but let’s ignore that for now). If you are used to using a real code editor, you’ll probably switch to doing your Arduino coding in that and then use the external editor integration in the IDE.

That works pretty well, but there are other options. One we noticed, PlatformIO, extends GitHub’s Atom editor. That makes it cross-platform, powerful, and with plenty of custom plug ins. It also supports a range of platforms including Arduino, many ARM platforms, MSP430, and even desktop computers running Linux or Windows.

The author claims the plug in will generate code for over 200 embedded boards. It handles all the common development tasks and even includes a terminal window. There are command line tools if you want to build scripts or make files and bypass the GUI.

You can install Platform.io on Windows, Linux, or Mac. It uses Python, so porting it elsewhere might be easy, too. The feature list is broad: code completion, linting, multiple projects, and library management. It can even import projects from the Arduino IDE. There are plenty of plug ins to add features (like Emacs keybindings, although that took a little troubleshooting).

There is also something attractive about having a single IDE that targets different platforms if you switch back and forth a lot. In all fairness, the Arduino IDE isn’t as bad as it used to be, and they both have significantly improved versions in the works (Arduino Create and Arduino Studio). We’ve seen plenty of other IDE hacks for Arudino in the past.

Thanks for the tip [Martin]

21 thoughts on “Atomic Arduino (and Other) Development

  1. There is nothing wrong with the Ardu IDE?
    If you run into limitations you work around them, not change the IDE?

    An IDE should be simple and creative to use and not a pain in the as like Eclipse.

    So the Arduino IDE, while not optimal, is both simple and creative.

    You wont write a better application just because of the IDE.

    1. Arduino IDE is alright, but has it’s quirks. Yeah – I agree that Eclipse is a big PITA, but this supports NetBeans, which is a good IDE (Except for my dev stuff, I use JetBrains (And pay for it) for it’s a lot better than NetBeans.). There are things that IDE do to make development faster. For instance, gives you a quick popup of what a function needs for inputs, so no having to google crap all the time.

    2. One thing wrong with Arduino IDE is that it’s not only an editing/build system, but also comes with kind of a primitive operating system. That’s entirely fine, even awesome for simple tasks, but gets into the programmer’s way the more complex and performance-oriented a project becomes.

      Another wrong thing is that it insists on certain restrictions in the file layout of a project. Up to 1.6.5 or 1.6.7 it was forbidden to have files in subfolders – they would simply be ignored. Now (1.6.8) it supports subfolders, but forbids files with a dash in its name. And it sucks up all subfolders blindly, even ones with entirely unrelated code.

      Third wrong is, one can’t have more than one project in the same folder. Because the .ino file name must match the name of the folder. Pretty pointless restriction.

      As said, all these wrongs are no problem for simple projects. There they’re even handled automatically. But the more complex a piece of software gets, the more these “features” get into the way. Arduino IDE has broken compilation of Teacup Firmware, a 3D printer controller software, again. Instead of rearranging everything another time, we wrote a simple Python GUI for compiling and uploading. In addition to the already existing Makefile.

    3. Ardu IDE is good enough?

      Is that a troll?

      I’ve ran the Arduino IDE on several different computers and keep getting the same problem. It doesn’t fill it’s own window. i can resize, maximize, minimize, restore, etc.. all I want. I get a window of mostly white space and not enough screen realestate is used for me to actually get anything done. This happens randomly. The only fix I have found is to close and then re-open. What a POS!

      Then there is the fact that building only saves to a temporary file. Make some changes, build, close, re-open.. in any other IDE I have ever used your changes stuck because it saved when you built. Do that in the Arduino IDE and watch the curses flow!

      Why aren’t any of the normal keyboard shortcuts that almost every application since about 1982 mapped? Really… alt-f-s! That should save the file! Not in Arduino.. it just sticks an fs in whatever unlucky spot your curser is currently in.

      Why does Arduino insist on opening a new file ever d@$n time I open it? 90% of the time I just want to re-open some other file I already started. I have so many random files named after the dates I accidentally saved them! Then there is the fact that it opens a new window each time I open a file. Remember the whitespace bug I mentioned… every time it opens a new window is a new opportunity to hit that bug! So many times I get a perfectly good looking blank file window that I didn’t want and then a useless mostly whitespace window when I try to open the file that I did actually want.

      These are just basic program expectations I am talking about here. I’m not even bothering about more advanced IDE and text editor features. I would expect better out of a high-school kid’s spare time minesweeper clone!

      Ive seen this white space bug btw on at least 3 different computers and across several versions of java. I can’t believe this is happening to everyone or the internet would be screaming bloody murder… wouldn’t it? But.. I’ve had the same problem so many places… I can’t believe it’s just me either!

  2. Nice will check it out, currently I use notepad++ and the IDE in read only mode. It’s the editor and project management parts that makes it a pain to use. The platform selection and compiler system is nice, much better than make files and avrdude…

    1. Atom is written in JavaScript/coffee script. It’s wicked, fast.

      It’s a decent editor, almost IDE. I’ve been using it full time for development work in PHP and Python as well as a little JavaScript work for about 6 months. I no longer use any of my clunky IDE tools because Atom does pretty much everything I need it to do. I’ll definitely look at this arduino extension.

  3. My burden with Arduino since Particle revealed Photon was the the requirement for programming via wire. I am a huge advocate for the wireless programming of the Photon and wish Arduino would adopt this method that way you can engineer on the fly rather than disassemble and test, reassemble etc.

    1. The cli platformio software supports other IDEs as well, including eclipse, VIM, QtCreator and Sublime Text. I’d use any of those over the atom IDE any day.

      The trend of using a Chrome V8 (basically a web browser ) instance for a text/code editor is horrible. It eats up 200-300MB of RAM and that’s just at startup. It’s also slow on underpowered hardware (I’m thinking a quad core pentium here). I’m seeing this trend with many other applications such as the Nylas email client as well. I really hope that it won’t catch on. The last thing I need is to have a running browser instance for every desktop app I have open.

  4. Could someone explain why the Arduino IDE has warnings OFF by default (no -Wall)? I’d imagine it could save new programmers (and seasoned programmers as well!) from mistakes. Here are some examples which all compile without any warnings at all:

    //Using “=” instead of “==” in a conditional
    if ( value = true )
    stuff();

    //forgetting to specify a return value in a function
    unsigned char returns_one()
    {
    unsigned char return_value = 1;
    //forgot to return a value
    }

    if(returns_one() == 1)
    do_stuff();

    //accidentally forgetting to use a variable by mistyping or otherwise. Also encourages keeping code tidy.
    unsigned char variable_1 = 4;
    unsigned char variable_2 = 5;

    unsigned char sum = variable_1 + variable_1; //meant to write variable 2

    //misleading indentation (for some reason, Arduino IDE doesn’t use this when “All” warnings enabled, even though it’s part of -Wall)
    if(conditional_statement)
    a = 5;
    b = 2; //this is always executed!

    Complete list of warnings here (search page for -Wall): https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html , I think these are the most likely ones though.

    1. I prefer this:

      if(true == value)

      Better yet, for simple bools just do if(value)
      but for non-bools you might do something like
      if (5 == thenumber)

      Once you get your brain trained to always code this way you never miss that mistake again. If you did miss an equal sign you would have this.

      if (5 = thenumber)

      That will throw an error for sure!

  5. if(true == value)

    Better yet, for simple bools just do if(value)
    but for non-bools you might do something like
    if (5 == thenumber)

    Once you get your brain trained to always code this way you never miss that mistake again. If you did miss an equal sign you would have this.

    if (5 = thenumber)

    That will throw an error for sure!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s