The Arduino IDE is nice to get beginners started, but you’ll quickly hit its limitations. And if, like me, you found an option in the preferences dialogue that enables an external editor, you’ll have been disappointed to find that it seems only to disable the internal editor!
It is possible to work entirely outside the IDE, with your own editor (like Emacs or Eclipse) and build your projects from the command line (or in another IDE). Here’s one way to do it…
You should make sure that the Arduino IDE is working first. This will ensure the compiler, C-library an Arduino libraries are installed and working correctly and that you can communicate with your Arduino. Then you’ll want to use a Makefile. I’ve spent some time writing one, in collaboration with quite a few other people, an it’s available here. It’s very easy to use, quite fully-featured, and as compatible with the IDE as possible. (Other makefiles also exist, of course.)
OK, so to build your project outside the IDE, you’ll need to do the following:
- Download the `arduino.mk` ([from here](http://ed.am/dev/make/arduino-mk)). You should save it somewhere accessible, like in your home directory. I keep mine at `~/src/arduino.mk`.
- In your project directory, edit your main file and save it as a `.ino` file, just as you would in the IDE.
Create yourself a `Makefile`, with the following in:
BOARD = uno
Obviously, you should replace `~/src/arduino.mk` with the location you saved the Aruino makefile. Having saved `Makefile`, you can run `make boards` to see what board names exist. Then, you should set the `BOARD` variable correctly (“uno” may not be correct).
And that’s it!
To build your project, you should only have to type
To upload it to the Arduino board, go
(If it can’t detect your Arduino by its self, you may need to set the
SERIALDEV variable in your
And if you want to use the Serial Monitor from the Arduino IDE without running the IDE, you can achieve this by going
This actually runs GNU screen. (You’ll need to remember the shortcut keys to kill screen (
^a k, by default) so that you can get out of it!)
If something goes wrong or isn’t working, you should have a look at the documentation for arduino.mk.