Arduino via the command line

For my Project Greenhouse I need to upload an Ardunio sketch from my Raspberry Pi.

sudo apt-get install arduino-mk

Add a Makefile (following these instructions) which will compile any file .ino in the same directory.

# Arduino 0011 Makefile

ARDUINO_DIR   = /usr/share/arduino
ARDMK_DIR     = /usr

#   A tag identifying which type of Arduino you’re using. This only works
#   in version 0.6 and later.
#   The port where the Arduino can be found (only needed when uploading)
#   If this expands to several ports, the first will be used.
#   A list of any libraries used by the sketch—we assume these are in
#   $(ARDUINO_DIR)/hardware/libraries.

BOARD_TAG    = uno
ARDUINO_LIBS = # Ethernet Ethernet/utility SPI

include $(ARDUINO_DIR)/

Then a simple ::

make upload

and you’re done.

Note: If you get an error saying

stty: -hupcl: No such file or directory
make: *** [reset] Error 1

you need to change your ARDUINO_PORT.

comments powered by Disqus