Tag Archives: Arduino CLI

Detect problems with your Arduino projects

via Arduino Blog

This article was written by Per Tillisch, Tooling Team SW Engineer at Arduino.

The Arduino team created a tool to check Arduino projects for common problems. Arduino Lint runs over 175 checks on your sketches, libraries, and boards platforms which cover specification compliance, Library Manager submission requirements, and best practices.

Arduino Lint

Arduino Lint is an easy to use, yet powerful, command line tool. Its focus is on the structure, metadata, and configuration of Arduino projects, rather than the code.

Getting started

Follow the installation instructions to get ready to use Arduino Lint: https://arduino.github.io/arduino-lint/latest/installation/

Now you only need to open a terminal at your project folder and run the command: arduino-lint

This will automatically detect the project type and check it against the relevant rules.

The default configuration of Arduino Lint provides for the most common use cases, while offering the option to change settings via command line flags.

Configuration

Compliance setting

The --compliance flag allows you to configure the strictness of the applied rules. The three compliance level values accepted by this flag are:

  • permissive – failure will occur only when severe rule violations are found. Although a project that passes at the permissive setting will work with the current Arduino development software versions, it may not be fully specification-compliant, risking incompatibility or a poor experience for the users.
  • specification –  the default setting, enforces compliance with the official Arduino project specifications (sketch, library, platform).
  • strict – enforces best practices, above and beyond the minimum requirements for specification compliance. Use this setting to ensure the best experience for the users of the project.

Library Manager setting

Arduino Library Manager is the best way to provide installation and updates of Arduino libraries. In order to be accepted for inclusion in Library Manager, a library is required to meet some requirements.

Arduino Lint provides checks for these requirements as well, controlled by the --library-manager flag.

The Library Manager submission-specific rules are enabled via --library-manager submit.

Even if your library isn’t yet ready to be added to Library Manager, it’s a good idea to use this setting to ensure no incompatibilities are introduced.

Once your library is in the Library Manager index, each release is automatically picked up and made available to the Arduino community. Releases are also subject to special rules. The command arduino-lint --library-manager update will tell you whether your library is compliant with these rules.

Integration

The --format flag configures the format of arduino-lint‘s output. The default --format text setting provides human readable output. For automation or integration with other tools, the machine readable output provided by --format json may be more convenient. This setting exposes every detail of the rules that were applied.

The --report-file flag causes arduino-lint to write the JSON output to the specified file.

Continuous integration

Arduino Lint would be a great addition to your continuous integration system. Running the tool after each change to the project can allow you to identify any problems that were introduced.

This is easily done by using the arduino/arduino-lint-action GitHub Actions action: https://github.com/arduino/arduino-lint-action

Add a simple workflow file to the repository of your Arduino project and GitHub will automatically run Arduino Lint on every pull request and push.

Give it a try!

Will your project get a passing grade from Arduino Lint? There’s only one way to find out…

Support and feedback

You can discuss or get assistance with using Arduino Lint on the Arduino Forum.

Feedback is welcome! Please submit feature requests or bug reports to the issue trackers:

arduino-cli 0.14.0 is out and ready for the public!

via Arduino Blog

This article was written by Silvano Cerza from the Arduino Tooling team.

It’s been a while, so this time around you’re in for a treat. Don’t forget to go through the list of breaking changes and the new upgrade guide, this might save you some headaches.

Highlights for our latest release include:

  • Added flags to install libraries from a local zip file or git url
  • Added a `–clean` flag for the `compile` command
  • Added a `–dest-file` flag to the `config init` command
  • Better tracking of installed platforms
  • A few useful UX improvements
  • A bunch of bug fixes

The complete changelog is available here!

As you may know, the Arduino CLI is still in “alpha” state, meaning that the tool is under heavy development. This is the reason why here and there we still introduce some breaking changes:

  • Use debug “configurations” instead or “recipes” (#1033)
  • Local binaries export (a `build` folder in your sketch) must now be explicitly specified (#1042)
  • Programmers can’t be any longer listed using using the `burn-bootloader` programmers list flag (`-P list`) (#982)
  • `lib install –git-url` or `–zip-file` must now be explicitly enabled (#1075)

Might seem like a lot, but not to worry! We’ve prepared an upgrade guide that you can find here.

CLI and IDE get better together

via Arduino Blog

This article was written by Silvano Cerza and Ubi de Feo from the Arduino Tooling team.

Over the past two months our newly established Tooling Team has taken over operations concerning the Arduino CLI and Pro IDE.

We’ve been silent at work in our little rooms, striving to come up with solutions to reported issues and feature requests.

As time went on, the development of the CLI and Pro IDE has been moving forward in a parallel fashion, so here we bring you new versions of both applications for you to play with and build your workflows around.

arduino-cli 0.12.0

The new Arduino CLI is alive and kicking!

Highlights for this release include:

  • We introduced high-level update, outdated, upgrade commands to make arduino-cli more package manager like
  • Package index is now downloaded automatically at first run
  • Custom post-installation scripts can now be executed safely (3rd party cores will issue non blocking warnings)
  • Slight but useful UX improvements
  • Bugfixes
  • Security bugfixes

Remember, we have CLI nightly builds if you want to stay updated on the latest features!

Release link

Arduino Pro IDE

The Arduino Pro IDE is now better than ever! The team squeezed out a very juicy release, enough to skip ahead in the version numbers and jump from 0.0.6 to 0.1.0.

Highlights for this release include:

  • Updated the bundled CLI version to ‘0.12.0’
  • Reworked the menu organization
  • Added support for upload using external programmers
  • UI bugfixes aplenty

We are pleased to announce that from now on we have nightly builds available if you want to try out the latest features (and bugfixes). They can be found at the links below depending on your preferred operating System:

Release link

The three pillars of the Arduino CLI

via Arduino Blog

The Arduino CLI is an open source command line application written in Golang that can be used from a terminal to compile, verify and upload sketches to Arduino boards, and that’s capable of managing all the software and tools needed in the process. But don’t get fooled by its name: the Arduino CLI can do much more than the average console application, as shown by the Pro IDE and Arduino Create, which rely on it for similar purposes but each one in a completely different way from the other.

In this article, we introduce the three pillars of the Arduino CLI, explaining how we designed the software so that it can be effectively leveraged under different scenarios.

The first pillar: command line interface

Console applications for humans

As you might expect, the first way to use the Arduino CLI is from a terminal and by a human, and user experience plays a key role here. The UX is under a continuous improvement process as we want the tool to be powerful without being too complicated. We heavily rely on sub-commands to provide a rich set of different operations logically grouped together, so that users can easily explore the interface while getting very specific contextual help.

Console applications for robots

Humans are not the only type of customers we want to support and the Arduino CLI was also designed to be used programmatically — think about automation pipelines or a CI/CD system. 

There are some niceties to observe when you write software that’s supposed to be easy to run when unattended and one in particular is the ability to run without a configuration file. This is possible because every configuration option you find in the arduino-cli.yaml configuration file can be provided either through a command line flag or by setting an environment variable. To give an example, the following commands are all equivalent and will proceed fetching the unstable package index that can be used to work with experimental versions of cores: 

See the documentation for details about Arduino CLI’s configuration system.

Consistent with the previous paragraph, when it comes to providing output the Arduino CLI aims to be user friendly but also slightly verbose, something that doesn’t play well with robots. This is why we added an option to provide output that’s easy to parse. For example, the following figure shows what getting the software version in JSON format looks like.

Even if not related to software design, one last feature that’s worth mentioning is the availability of a one-line installation script that can be used to make the latest version of the Arduino CLI available on most systems with an HTTP client like curl or wget and a shell like bash.

The second pillar: gRPC interface

gRPC is a high-performance RPC framework that can efficiently connect client and server applications. The Arduino CLI can act as a gRPC server (we call it daemon mode), exposing a set of procedures that implement the very same set of features of the command line interface and waiting for clients to connect and use them. To give an idea, the following is some Golang code capable of retrieving the version number of a remote running Arduino CLI server instance:

gRPC is language-agnostic: even if the example is written in Golang, the programming language used for the client can be Python, JavaScript or any of the many supported ones, leading to a variety of possible scenarios. The new Arduino Pro IDE is a good example of how to leverage the daemon mode of the Arduino CLI with a clean separation of concerns: the Pro IDE knows nothing about how to download a core, compile a sketch or talk to an Arduino board and it demands all these features of an Arduino CLI instance. Conversely, the Arduino CLI doesn’t even know that the client that’s connected is the Pro IDE, and neither does it care.

The third pillar: embedding

The Arduino CLI is written in Golang and the code is organized in a way that makes it easy to use it as a library by including the modules you need in another Golang application at compile time. Both the first and second pillars rely on a common Golang API, a set of functions that abstract all the functionalities offered by the Arduino CLI, so that when we provide a fix or a new feature, they are automatically available to both the command line and gRPC interfaces. 

The source modules implementing this API can be imported in other Golang programs to embed a full-fledged Arduino CLI. For example, this is how some backend services powering Arduino Create can compile sketches and manage libraries. Just to give you a taste of what it means to embed the Arduino CLI, here is how to search for a core using the API:

Embedding the Arduino CLI is limited to Golang applications and requires a deep knowledge of its internals. For the average use case, the gRPC interface might be a better alternative; nevertheless this remains a valid option that we use and provide support for.

Conclusion

You can start playing with the Arduino CLI right away. The code is open source and we provide extensive documentation. The repo contains example code showing how to implement a gRPC client, and if you’re curious about how we designed the low-level API, have a look at the commands package and don’t hesitate to leave feedback on the issue tracker if you’ve got a use case that doesn’t fit one of the three pillars.

Hands-on with the Arduino CLI!

via Arduino Blog

In our last post, we told you that the Arduino CLI’s primary goal is to provide a flexible yet simple command line tool with all the features and ease of use that made Arduino a successful platform, and enable users to find new ways of improving their workflows. 

The Arduino CLI is not just a command line tool, but contains all you need to build applications around the Arduino ecosystem.

For example, you can:

  • Parse the JSON output of the CLI and easily integrate it into your custom application.
  • Run the CLI as an always-on service that accepts commands via a gRPC interface using your language of choice.
  • Use the CLI in your Go application as a library.

In the video below, we’ll focus on how to start using the Arduino CLI in a terminal session. The tutorial will walk you through setting up all the required tools on your machine to the fastest way to compile and upload a sketch on your target board to allow quick iterations in developing your project with Arduinos.

arduino-cli 0.10.0 is out!

via Arduino Blog

The Arduino CLI is steady as she goes! The team is constantly fixing issues and modeling the user experience thanks to the community’s feedback.

Highlights for this release include:

  • board attach‘ command now also supports the upload port for an easier sketch upload
  • Minor UX improvements
  • Bugfixes

You can see the full list of changes here. We have also just opened a CLI dedicated forum section. Please check it out!