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

Publicado por

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


Últimas noticias

Lo sentimos, pero su selección de filtros no devolvió resultados.

Hemos actualizado nuestra política de privacidad. Por favor tome un momento para revisar estos cambios. Al hacer clic en Acepto, usted está de acuerdo con la Politica de Privacidad de Arrow Electronics y sus condiciones de uso.

Nuestro sitio Web coloca cookies en su dispositivo para mejorar su experiencia y nuestro sitio. Lea más sobre las cookies que utilizamos y cómo desactivarlas aquió. Es posible que se utilicen las cookies y tecnologías de seguimiento con fines de marketing.
Al hacer clic en "Aceptar", usted está consintiendo la colocación de cookies en su dispositivo y el uso de tecnologías de seguimiento. Haga clic en "Leer más" a continuación para obtener más información e instrucciones sobre cómo desactivar las cookies y tecnologías de seguimiento. Si bien la aceptación de cookies y tecnologías de seguimiento es voluntaria, la desactivación de estos puede resultar en que el sitio web no funcione correctamente, y es posible que ciertos anuncios sean menos relevantes para usted.
Respetamos su privacidad. Lea nuestra política de privacidad aquió