Arduino Releases Command Line Interface (CLI) Alpha Preview

So far, AFAIK the only official ways to program Arduino boards were through the Arduino IDE program, or the cloud-based Arduino Create which works in your web browser and does not require any installation on your computer.

While graphical interfaces are nice and user-friendly, many of us are more productive while working using the command line,  especially if commands can be scripted. So Arduino decided to work on a command line interface (CLI) for professional users, and have just announced a preview release.

arduino-cli

arduino-cli works in Windows, Linux, and Mac OS, and allows you install libraries, boards, and cores (e.g. esp32 Arduino core), compile the code, and upload the binary to the target board.

If you want to get started quickly, you can download the binary “alpha” releases in the announcement board, but instead I opted to build the client myself as explained on Github. Everything below is done in Ubuntu 18.04.


I don’t have a board handy right now, so I’ll just try some commands to create new project, install boards, and build the code again mostly following the README in github.

  • Creating a new sketch


This create a Sketch with minimal code:

  • Modifying the code with vi/emacs, or other editors

  • Finding core and install it:


There’s no ESP32, so I used esp8266 instead, and it’s already installed on my system so nothing to do here if you plan to go with ESP8266, but if you had another board with the core not installed, that’s how we’d go:

  • Listing and installing libraries

Command the list already installed libraries:


Command to search for a library to install:


Installing the library:

  • Building our sketch for MKR1000

  • Checking board connection

While I don’t have a board here with me, I do has a USB to TTL debug board detected by the following command:


It shows “unknown” because it’s not an Arduino board, but you’d have the same results if the Arduino core for your board was not installed for example. If it is, the board name will be displayed.

  • JSON parsing

They also implemented an option to output JSON data for parsing by other program. e.g.:


jq is a command line JSON processor used to “beautify” the output.

arduino-cli json

Arduino Command Line Interface is a welcomed development, and it looks to work reasonably well considering it’s still alpha stage software.

Support CNX Software - Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples
Subscribe
Notify of
guest
6 Comments
oldest
newest most voted
Advertisements