Arduino CLI: Text-based user interface & command line developer tools

Pubblicato da

Arduino's "classic" IDE has been used for coding a wide array of projects, from simple sensors, to robots, and more. While extremely well documented at this point, it's also sometimes maligned for having a somewhat limited interface. The good news is that there are other options available, including the Arduino Pro IDE, and Visual Studio Code. Yet another option is the Arduino CLI, the Arduino Command Line Interface.

As the name implies, Arduino CLI isn’t an "environment" in a graphical sense, as much as it's a set of tools you can access from the command line on your Windows, macOS, or Linux computers. This allows you to create a new sketch with a few strokes of the keyboard, edit in your favorite text editor, and upload it to your Arduino board – with a few more keyboard punches. While it's certainly not for everyone, if you're more comfortable in a terminal than swiping a mouse left and right, then this is a great option to have.

Perhaps the real selling point of such a setup is the interoperability with different pieces of code. It has a JSON interface that can parse output for the command line, can be integrated with make files, and used to automate compilation of Arduino code. The CLI is capable of integration with different IDEs, and gives the advanced programmer a few previously unavailable basic tools to work with.

If this sounds interesting, let's discuss the simple process of installation:

How to install Arduino CLI

On Windows-based systems, simply download the pre-built binary from Arduino's GitHub.io page, extract it, and place it in the directory of your choosing. To try this out, open the command prompt and navigate the directory where the CLI executable is stored, then run arduino-cli.exe. This will give you some hints as to how to use it. You can also run arduino-cli sketch new NewSketchName to create a new sketch/directory.

To enable yourself to use this command everywhere, set up your system up so the Path environment variable includes the directory where the Arduino CLI binary resides.

Install Arduino CLI on Mac

On macOS systems, the process is largely the same. Download the Mac OSX package, unzip it, and place it in an accessible directory. Navigate to that location in terminal. Then run the command arduino-cli. You'll also want to set things up with your environment path, as with Windows systems.

Arduino CLI Image 1

On macOS, it may be easier to set things up via the Homebrew package manager. If you don't already have it available, open up the terminal and enter the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once you've done that, enter the commands:

brew update, then brew install arduino-cli

You'll immediately be able to run arduino-cli from different directories. The same Homebrew procedure is listed as a Linux installation option, as well. I personally haven't tried it under Linux, but given my good macOS experience, it would be where I'd likely start.

Arduino CLI: a text-based user interface solution to automation

Once you can open this simple text-based user interface, you'll be able to accomplish a wide range of tasks, such as creating a new sketch, checking whether a board is attached, adding support for boards, and uploading firmware. You can then automate these tasks as you see fit. You'll be able to integrate them with other software, too. While this tool is perhaps best suited for advanced users, it gives you a place to work from, when more established graphical methods don't quite suit your needs.

newsletter 1


Ultime notizie

Sorry, your filter selection returned no results.

Non perderti le ultime novità sull'elettronica

Abbiamo aggiornato la nostra politica sulla privacy. Si prega di prendere un momento per rivedere questi cambiamenti. Cliccando su Accetto, l'utente accetta la Politica sulla privacy e Condizioni di utilizzo di Arrow Electronics.

Il nostro sito web mette i cookies sul vostro dispositivo per migliorare la vostra esperienza e il nostro sito. Leggete altre informazioni sui cookies che usiamo e su come disabilitarli qui. I cookies e le tecnologie di tracking possono essere usati per scopi commerciali.

Con un click su “Accept”, voi consentite l'inserimento dei cookies sul vostro dispositivo e l'uso da parte nostra di tecnologie di tracking. Per avere altre informazioni e istruzioni su come disabilitare i cookies e le tecnologie di tracking, clickate su “Read More” qui sotto. Mentre l'accettazione dei cookies e delle tecnologie di tracking è volontaria, una loro disabilitazione potrebbe determinare un funzionamento non corretto del sito web, ed alcuni messaggi di allarme potrebbero essere per voi meno importanti.

Noi rispettiamo la vostra privacy. Leggete qui la nostra politica relativa alla privacy