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

게시자

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


최신 뉴스

Sorry, your filter selection returned no results.

개인정보 보호정책이 업데이트되었습니다. 잠시 시간을 내어 변경사항을 검토하시기 바랍니다. 동의를 클릭하면 Arrow Electronics 개인정보 보호정책 및 이용 조건에 동의하는 것입니다.

당사의 웹사이트에서는 사용자의 경험 향상과 사이트 개선을 위해 사용자의 기기에 쿠키를 저장합니다. 당사에서 사용하는 쿠키 및 쿠키 비활성화 방법에 대해 자세히 알아보십시오. 쿠키와 추적 기술은 마케팅 목적으로 사용될 수 있습니다. '동의'를 클릭하면 기기에 쿠키를 배치하고 추적 기술을 사용하는 데 동의하는 것입니다. 쿠키 및 추적 기술을 해제하는 방법에 대한 자세한 내용과 지침을 알아보려면 아래의 '자세히 알아보기'를 클릭하십시오. 쿠키 및 추적 기술 수락은 사용자의 자발적 선택이지만, 웹사이트가 제대로 작동하지 않을 수 있으며 사용자와 관련이 적은 광고가 표시될 수 있습니다. Arrow는 사용자의 개인정보를 존중합니다. 여기에서 당사의 개인정보 보호정책을 읽을 수 있습니다.