= Compiling an Arduino project on the command line = By default the Arduino package comes with a simple IDE to edit, compile and upload code to the controller. For small projects this editor gives you a reasonable amount of comfort and features. When editing larger source code the editor becomes annoying. You start to which that you can easily use your favorite editor and compile and upload the produced code the way you are used to it, over the command line. = Download and install the latest (working) Ardunio = Download and install the latest package either from your distribution repository or directly from the [http://arduino.cc/en/Main/Software Arduino] page. Remember where the installation path is. = Create a Project = Create a project directory where you want to put your source code to. {{{ cd  /where/ever/your/project/path/is mkdir PROJECT_NAME }}} The PROJECT_NAME has to be the same name as the main source code file which includes the setup and loop functions. Then you have to copy two files to that directory. First the Makefile which you can download below. A key point that was hard to figure out, was that the Arduino needs to be reset right before a program is uploaded. This is automatically done by the IDE, but not by the Makefile. If this is not in place, you’ll get error messages like: {{{ stk500_recv(): programmer is not responding }}} or {{{ avrdude: stk500_getsync(): not in sync: resp=0x16 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x34 }}} to fix this, create a python script like below and place it either somewhere your $PATH is pointing or simply right into your project directory and make it executable. The script can also be downloaded from the link at the bottom of this pace. {{{ chmod u+x pulsedtr.py }}} {{{ import serial import time import sys if len(sys.argv) != 2: print "Please specify a port, e.g. %s /dev/ttyUSB0" % sys.argv[0] sys.exit(-1) ser = serial.Serial(sys.argv[1]) ser.setDTR(1) time.sleep(0.5) ser.setDTR(0) ser.close() }}} Prepare your Makefile by changing the following line for your needs. {{{ INSTALL_DIR = /install/path/of/arduino PORT = /dev/ttyUSB0 MCU = atmega8 F_CPU = 16000000 }}} Now you can start editing your program file. Save it and compile it by type '''make '''and upload it to your board by '''make upload''' at the command line. '''Attention! '''To include libraries from Arduino you have to prepend the path to the included header file started from /install/path/of/arduino/hardware/libraries/ Thats it!