Reputation: 51565
I would like to use Emacs as a development environment for Arduino programming. What are some tips or links to use Emacs to program Arduino?
Is there an official (or de facto) Emacs mode?
Also, am I going to miss something in Arduino IDE if I use Emacs exclusively?
Upvotes: 28
Views: 9248
Reputation: 41
Choose C++ Mode in Emacs, then run the files in the Arduino IDE. Choose avr-gcc as the compiler, and avrdude as the uploader, if you want to compile in Emacs. Merry making!
Upvotes: 0
Reputation: 1341
There's a nice Arduino mode on GitHub.
Just wraps cc-mode, but it does a nice job.
Update:
The EmacsWiki has a page dedicated to Ardunio Support for Emacs. The setup has a few steps but once done it allows you to compile and upload sketches from inside Emacs.
Upvotes: 15
Reputation: 174
The commands that the Arduino IDE uses in the background change often, so the above info is probably out of date. I'm using IDE version 1.6.4 at the moment.
To find out the current commands, in the Arduino IDE | File | Preferences, check "Show verbose output during: x compilation x upload". Then you can see the full command in the IDE log window, and adapt your Emacs Makefile to use them.
For IDE 1.6.4, targeting a LilyPad Arduino board, that shows avr-gcc for the compiler, and avrdude for the uploader.
Upvotes: 1
Reputation: 3949
There is support in the Emacs tool CEDET for programming with Arduino. As I write this, the support is available in CEDET 1.1 or later from cedet.sf.net.
It has all the development features as described for CEDET, plus Arduino only features, like uploading your program to the Arduino. See more here:
http://www.randomsample.de/cedetdocs/cedet/Arduino-Features.html
Upvotes: 4
Reputation:
I use this Makefile and I find it very useful.
http://ed.am/dev/make/arduino-mk
As previously mentioned you do not need any external mode.
Since I am a newbie interested about learning Arduino I write small programs. Instead of creating several sub directories, one per snippet, and putting the makefile in each I decided to do it on one directory.
So that I'd be able to built the last edited source file (*.cc) . Here is my current Makefile.
SOURCES := $(shell ls -tp *.cc | grep -v /$ | head -1)
BOARD := uno
LIBRARIES := Stepper
include ~/arduino/arduino.mk
Upvotes: 1
Reputation: 49339
You can enable an external editor option that will allow you to edit projects using external editors and then use the Arduino IDE as some kind of terminal just for compiling and uploading.
I just edit stuff in Emacs, then switch to the IDE to just hit compile and upload. No need for makefiles.
Upvotes: 11
Reputation: 19496
Arduino code is just C++ wearing a dress and hat. You should be able to use that mode in Emacs without problems. You may miss the one-click-compile-and-transfer button, as well as the organization of the libraries from the official IDE. You can replicate either in Emacs of course. There is nothing the official IDE does that Emacs can't do.
Upvotes: 5