Raspberry: upload Arduino sketch from CLI


install these packages

sudo apt-get install arduino-core arduino-mk

Then add yourself to the dialout group to allow you to upload code to the Arduino board

sudo usermod -a -G dialout pi (Change pi to be your username if different)

Create Makefile

ARDUINO_DIR = /usr/share/arduino
BOARD_TAG = uno
ARDUINO_PORT = /dev/ttyACM*
ARDUINO_LIBS =
include /usr/share/arduino/Arduino.mk

to build

make

to upload

make upload