Arduino from the command line in Ubuntu 12.04


Martyn Davis is an Arduino enthusiast whose operations have outgrown the stock Arduino GUI IDE.

“If you’ve done more than a bit of programming in the past, you’ll soon find the dinky IDE a little frustrating to use. For example, my preferred text editor, by far, is vim, and I find it quite jarring to be forced to use a basic text editor to build programs. Yes, you can select “use external editor” in the settings, but it’s clumsy. I’ve built many an Arduino program in vim, then switched to the Arduino IDE to build it. It’s just not streamlined – it’s too slow and clunky.

It was therefore with delight I saw in the kubuntu 12.04 repository (I recently re-installed everything on my desktop after falling back in love with KDE) that there’s a package called arduino-mk which promises to provide the ability to build arduino programs directly from the command line. Which means you can use vim (or emacs if you’re weird) and makefiles.”

Follow the details after the fold.

Noting that arduino-mk doesn’t work out of the box, Martyn Davis has written this article describing the steps he found necessary to get Arduino programming up and running from the command line.

His instructions build on the excellent foundation on this subject by Martin Oldfield, developer of arduino-mk. See “Martin’s Atelier” website for additional details and links to download the code libraries (recently updated for use with Arduino 1.0.)

This entry was posted in Arduino, code, how-to and tagged , .

Comments

  1. Brian says:

    vim and Arduino, now that is an odd couple.

    • Jim says:

      No kidding! You’d think that if he’s a vim user, he’s probably be a power user and would have graduated to full-on AVR programming (plain C and inline assembly and maybe using the Arduino as an ISP if he’s too cheap).

      Weirder than using emacs, that’s for sure.

      • davek says:

        Switching to straight-up AVR development leaves behind a lot of community and code. The Arduino layer really does bring a lot to the table, it just doesn’t bring much in the way of editor.

        For those who aren’t looking for vim, CodeBlocks Arduino Edition or VisualMicro (Visual Studio extension) might be an option.

      • Barnaby Jackson Pollock says:

        That’s my eventual plan. Baby steps, though. Just got my uno, and I’m going to let the IDE hold my hand until I’ve made an LED flash or something. Then I’m going to get down into the weeds and figure out what the ide’s hiding from me. In the meantime, it’ll be wonderful not to have to give up vim.

        Honestly, if you program or do a lot of plaintext editing of any kind, you’re a masochist if you’re not using vim, emacs, or some similarly full featured editor. You really can’t comprehend how much time you’ll save until you’ve used it for a while and actively learn the shortcuts. RSI sucks, take precautions now.

  2. Benjamin Fiset-Deschenes says:

    One day I will learn the power of vim!

  3. MikeSmith says:

    Alternatively, there’s a cross-platform Makefile (OS X, Linux, Windows/Cygwin) for Arduino here:

    http://code.google.com/p/ardupilot-mega/source/browse/libraries/AP_Common/Arduino.mk

    that faithfully emulates the IDE’s handling of sketches, libraries, .ino files, etc. etc. with less configuration.

    (shameless plug – I originally wrote this)

    = Mike

    • davek says:

      Cool, thanks, I may be able to use this. It looks pretty straightforward to use, do you happen to know if it’ll work against the arduino-core deb package?

  4. MikeSmith says:

    The Arduino dependencies are pretty straightforward; worst case you may have to set ARDUINO to help it find the core depending on where the package ultimately installs it.

  5. Bogdan says:

    Arduino is very good when you want to write a program fast, because it has many libraries.
    Although I’m very familiar with the AVR (peripherals, assembler instructions), there are many times when I just want to write a small program fast, and then I use Arduino and it’s libraries.
    After the initial prototyping, if you need to optimize the program, but keep the logic, it’s ok to rewrite it in plain C without using the Arduino libraries.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.