Arduino CLI

Arduino CLI is a command line tool that can replace the functionality of the graphical Arduino GUI.

You can build, upload, use libraries, read the serial monitor of any board supported by Arduino in a headless setup, which means you can use your favorite editor for code editing and work remotely without relying on VNC or X-Forwarding.

Example Build Script

#!/usr/bin/env bash


function setup {
   arduino-cli core install STMicroelectronics:stm32 --additional-urls 

function compile {
   arduino-cli compile . -b ${core}:${board} \
        --board-options ${board_options}

function upload {
    arduino-cli upload . -b ${core}:${board} \
        --board-options ${board_options}

function monitor {
    arduino-cli monitor -p /dev/ttyACM0 -c baudrate=115200

function details {
    arduino-cli board details -b ${core}:${board}

# easily run subcommands.  e.g. "./build upload"

Then you can simply flash new code with

./build upload

Connecting Monitor

acli monitor -p /dev/ttyACM0 -c baudrate=115200

Searching/Installing Additional Cores

Search default list of cores

acli core search foo

Search cores on third-party URLs

acli core search stm --additional-urls

Listing Available Boards or Board Options

List installed boards

acli board listall

List available options for installed board

acli board details -b STMicroelectronics:stm32:Nucleo_144