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

Veröffentlicht von

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


Neue Beiträge

Leider ergab Ihre Suche kein Ergebnis

Aktuelles über Elektronikkomponenten­

Wir haben unsere Datenschutzbestimmungen aktualisiert. Bitte nehmen Sie sich einen Moment Zeit, diese Änderungen zu überprüfen. Mit einem Klick auf "Ich stimme zu", stimmen Sie den Datenschutz- und Nutzungsbedingungen von Arrow Electronics zu.

Wir verwenden Cookies, um den Anwendernutzen zu vergrößern und unsere Webseite zu optimieren. Mehr über Cookies und wie man sie abschaltet finden Sie hier. Cookies und tracking Technologien können für Marketingzwecke verwendet werden.
Durch Klicken von „RICHTLINIEN AKZEPTIEREN“ stimmen Sie der Verwendung von Cookies auf Ihrem Endgerät und der Verwendung von tracking Technologien zu. Klicken Sie auf „MEHR INFORMATIONEN“ unten für mehr Informationen und Anleitungen wie man Cookies und tracking Technologien abschaltet. Das Akzeptieren von Cookies und tracking Technologien ist zwar freiwillig, das Blockieren kann aber eine korrekte Ausführung unserer Website verhindern, und bestimmte Werbung könnte für Sie weniger relevant sein.
Ihr Datenschutz ist uns wichtig. Lesen Sie mehr über unsere Datenschutzrichtlinien hier.