In some chapters of this book, different libraries are needed; so let's see how a library can be installed.
The installed SDK has some basic libraries, but for sure, you will need more libraries to read various sensors, to parse JSON data, or to send MQTT messages. For the libraries that are referenced in the SDK repository, you just need to install them but for those that are not, you need to install them manually.
Some libraries exist in the official repository and you can install them in the following steps:
- If it exists, then just go to
Sketch
|Include Library
|Manage Libraries
:
- In a new window, delete the "
Filter your search..."
and writeArduino Json
. The Arduino IDE will then search this library for you and if it has found it, you will be able to install it by clicking on it. You can also use this menu for updating a previously installed library or to change between versions of a library:
- After the library is installed, you will see the following screen:
Sometimes the library you need may not exist in the official repository but you may have found it on http://github.com as a ZIP archive.
To install the library, in this case, you need to perform the following steps:
- Download the ZIP file and install it manually. For this, go to
Sketch|Include Library|
and select the downloaded library from your disk and pressAdd
.ZIP Library...Open
. - Include an existing library.
- To include an existing library, go to
Sketch
|Include Library
and select the library you want to include in your sketch. - The
.h
file will be added to your sketch and now you have access to the function a in this library to use them in your own program: