Arduino IDE: let’s build a new library #10.2

Arduino IDE

Welcome back to our programming tutorial using the Arduino IDE. Today we will explain how to build a library with the Arduino IDE.

You can take a look at the previous chapters of the course here:

In the previous article, the operation and implementation of a library was exposed. In this article we will show the procedure to create a new library.

The Code :: Block IDE is used to create the library. To download it click here. The IDE reqauires a manual installation.

STEP 1

The first step is of course to open Code :: Block. Once opened, create a new file (CTRL + SHIFT + N). If you use WIndows, the file should be saved in the folder C: \ documents \ Arduino \ libraries with the extension .h.

STEP 2

The next step consists in writing the code. To better understand this functionality, in this article we will start with something simple: we will declare the distinct frequencies with which the corresponding notes are associated, so as to compose a song without too much difficulty.

libreria

STEP 3

The library will contains the following declarations:

Once the code is complete, just save it.

STEP 4

In order to verify the actual functioning, open Arduino IDE. In this specific case,  to examine the correct functioning, a sketch will be reported concerning the composition of a song.

The code is as follows:

The library in question is called with the #include “pitches.h” statement. Everything inside the library can be used in the Arduino IDE code.

Follow us to keep yourself updated with the news!

Simone Candido è un ragazzo appassionato del mondo tech nella sua totalità. Simone ama immedesimarsi in nuove esperienze, la sua filosofia si basa sulla irrefrenabile voglia di ampliare a 360° le sue conoscenze abbracciando tutti i campi del sapere, in quanto ritiene che il sapere umano sia il connubio perfetto tra cultura umanistica e scientifica.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.