Arduino - libraries. Installation, connection, removal. Arduino libraries: connection What parameters to specify to enable the Arduino library

FAQ

  1. Open the zip file you downloaded from the site.
  2. Extract the DLL file to any location on your computer.
    • Next, we advise you to place the file in the folder of the program that requests this file. Make sure you are using a 32-bit DLL file format for a 32-bit program and a 64-bit DLL file format for a 64-bit program, otherwise you may receive error 0xc000007b.
  3. If the above steps do not solve your problem, place the file in the system folder. By default this folder is located here:
    • C:\Windows\System (Windows 95/98/Me),
      C:\WINNT\System32 (Windows NT/2000), or
      C:\Windows\System32 (Windows XP, Vista, 7, 8, 8.1, 10).
  4. On 64-bit Windows, the default folder for 32-bit DLL files is located here:

C:\Windows\SysWOW64\ , and for 64-bit DLL files
C:\Windows\System32\ .

Be sure to overwrite any existing files (but keep a backup of the original file).

Restart your computer.

If this does not resolve the issue, try the following steps to add the file to the registry:

For 32-bit DLL files on 32-bit versions of Windows and for 64-bit DLL files on 64-bit Windows:

  1. Open an elevated command prompt.
    • To do this, click Start, All Programs, select Accessories, right-click on Command Prompt, then click “Run as administrator.”
    • If you are asked to enter an administrator password or confirm, enter the password or click Allow.
  2. Next, type regsvr32 "filename".dll and press Enter.

To add 32-bit DLL files to the registry on 64-bit Windows:

  1. Open an elevated command prompt by following the steps above.
    • cd c:\windows\syswow64\
  2. Next, type the following and press Enter:
    • regsvr32 c:\windows\syswow64\"filename".dll

DLL files are dynamic libraries that are used by many programs on your PC. When you uninstall or update one of the programs from your PC, it may happen that DLL files previously installed in the operating system may be deleted by mistake. In addition to this situation, very often the system cannot detect DLLs due to viruses and unlicensed software, which certainly leave a negative mark on their presence on the computer.

Very often, DLL files disappear due to a break in the connection between the program and the operating system in cases where the user manually transfers the program from one folder to another. Only automatic and system tools for removing and installing programs on a PC can ensure the most comfortable use of your computer and operating system.

Dynamic-link library

DLL (English: Dynamic-link library) - dynamic library

DLL (English: Dynamic-link library) is a concept of the Microsoft Windows operating system, a dynamic library that allows repeated use by various software applications, a concept of the Microsoft Windows operating system. DLLs also include ActiveX controls and drivers.

The DLL file format follows the same conventions as the EXE executable file format, combining codes, tables, and resources.

Purposes of introducing DLLs

It was originally assumed that the introduction of DLLs would allow for efficient memory and disk space management using only one instance of library modules for many applications. This was especially important for early versions of Microsoft Windows with severe memory limitations.

Further, it was intended to improve the efficiency of development and use of system tools through modularity. Replacing DLL programs from one version to another should have allowed the system to be expanded independently without affecting applications. In addition, DLLs could be used by different types of applications - for example, Microsoft Office, Microsoft Visual Studio, etc.

Later, the idea of ​​modularity grew into the concept of ActiveX controls.

In fact, the full benefits of implementing DLLs were not achieved due to a phenomenon called DLL hell. DLL hell occurs when multiple applications require different versions of DLLs at the same time because they are not fully compatible, leading to serious conflicts. When the system grew to a certain size, the number of DLLs began to exceed many thousands, not all of them were fully reliable and compatible, and conflicts like DLL hell began to occur very often, sharply reducing the overall reliability of the system. Later versions of Microsoft Windows began to allow parallel use of different versions of DLLs, which negated the benefits of the original modularity principle.

The library already contains most of the code that you will not need to write, the library makes it easier to work with a specific module or one of their types and you just need to include it in your sketch.

For example, if you want to display text on an LCD display without connecting a library, then you need to pass it several bytes of commands and data, which will take several lines of code, and most importantly, you need to know the type of microcontroller under which the LCD display operates, the purpose of the commands it is controlled, know the architecture of its memory, addresses and purpose of registers, for which you will need to find and re-read its datasheet.

While when writing code using a library (for example LiquidCrystal_I2C.h), you can display text by calling just one library function:

lcd.print(“my text”);

You can connect any library with the following command:

"#include<файл.h>"

<файл.h>– this is the very library that we are connecting.

You can also see an example of connecting the library in the article.

Before you start using the methods and functions of the library, you need to:

  • download (download to your computer),
  • install (place in the desired folder),
  • to plug (insert the text “#include<файл.h>” into the sketch).

Each library must contain 2 files with extensions .h And .cpp.

The first type of files contains:

  • class description,
  • constants,
  • variables.

The second type contains method codes.

Additionally, you need to understand that files .h And .cpp may not be in the root of the downloaded archive. Also included with the main files are “keywords.txt” and a folder with examples.

How to install the library?

After you have downloaded (uploaded) the library to your computer, you need to install it. You can install the library manually or do it using the Arduino IDE:

Installing the library using Arduino IDE

We will do this through the menu. Go to the menu:

Sketch – Connect library – Add .ZIP library

In the window that appears, click on the “This PC” icon and select the “Downloads” folder. If, when downloading a ZIP archive from the site, you specified the path to save the file, then instead of the “Downloads” folder, specify the path to the file.

Select the library ZIP file you downloaded. The file name may not match the library name. Then click on the “ Open » ( Open ).

At this point, the installation of the library is complete, you can start connecting it to the sketch.

Important! After installing the Arduino IDE, a separate folder is created on the computer to store all libraries. For Linux OS "Scetchbook", located in /home/. For Windows OS, the "Arduino" folder is located in /My Documents/.

Installing the library manually

Unpack the ZIP archive you downloaded and place the folder (the folder name usually matches the name of the library) from this archive into the folder:

This computer Documentation Arduino libraries

If the Arduino IDE was running (open) during copying, then you need to close all windows of this program, then launch (open) the Arduino IDE and you can start connecting the library to the sketch.

The fact is that the program is constantly evolving and the number of its versions is constantly growing. If you want to install a new version of the Arduino IDE, the libraries located in the folder ( This computer → Documents → Arduino → libraries) will be available in both the old and new (installed) versions of the Arduino IDE, and the libraries located in the folder libraries Arduino IDE programs of the old version (which were installed previously) will only be available in it (until you copy them to the new one).

Where can I find the library I need?

For convenience, there is a whole section on our website called -. Most libraries can be found on the Internet in the public domain.

Also, a number of standard kits can be found on the official Arduino website: arduino.cc.

What libraries are already installed?

As we already discussed - the IDE itself already comes with some .

There are two ways to view installed libraries.

Method 1

To see which set is already installed, go to the tab:

Method 2

The second way is to use the "Sketch" menu and the "Connect Library" submenu. This way you can also see the list of libraries.

Go to Sketch and select Include library:

Sketch → Include library

Possible mistakes

Sometimes, when installing libraries or while using them, some errors may occur. Below we will look at the main ones.

‘xxxx’ does not name a type

The error appears when the library is not yet installed.

The error also occurs if the folder or library has the wrong name.

The folder location may be incorrectly specified or the Arduino IDE may not have been restarted!

Incorrect folder location

Check if all libraries are located at the correct address. We provided folder addresses for different operating systems above.

Invalid library name

The error appears when the name after the #include tag does not match the library name.

Incomplete library

All the necessary files and folders are missing.

Library dependencies

It is necessary to connect additional dependent libraries without which correct/correct operation is impossible.

A DLL file is a component of a dynamic link library whose elements are used by almost all programs. The DLL files are located in the system root folder. The components must all be present, digitally signed, work correctly and be up to date with the version. If one of the requirements is not met, the user will receive an informational notification when starting the program: DLL error. The malfunction indicates that the DLL file is missing, damaged, or outdated.

How to install a DLL file

In order for programs, applications and games to start working again, you must manually install the missing library components. Simply placing a file in a folder is not enough ─ you need to know how to register them.

Placing and registering library files

Before installing a DLL file on Windows 7,8,10, you need to download them, and exactly for the system bit depth.

Let's determine what bit capacity your system has (if you know for sure, you can skip this step)

Step 1. Right-click on “My Computer” and select “Properties”

Step 2. In the window that opens, we can read the properties of the computer, the version of the operating system and its bit depth 32 (x86) or 64 bit. In our case, we have a 64-bit Windows 10 operating system.

·

Step 3. After downloading the files, they need to be placed in the root folder and registered

for x32 (x86) systems, the component must be replaced or placed in the C:\Windows\System32 folder;

for x64 you need to replace it or move it to the C:\Windows\SysWOW64 folder;

Step 4. The file must be registered in the system.

You can do this by opening the command line with the combination “Win” + “R”, or clicking “Start” and “Run”;

in the window that opens, enter the following, separated by a space: regsvr32 file name.dll – where “regsvr32” is the command for registration, and “file name.dll” is the full name of the inserted component;

or you can specify the file location manually - regsvr32.exe + file path

Step 5. Click "OK" and restart your computer for the new settings to take effect.

I would like to note right away that errors may occur during registration. For example: "Failed to load module." They usually occur for 3 reasons

  1. The path to the file is incorrect, or the file was not moved to the System32 or SysWOW64 directory
  2. Not all DLL files need to be registered at all; sometimes it is enough to simply copy them to the System32 or SysWOW64 directory or place them in the root of the problematic game or program
  3. The files have already been registered before

Second registration method

Step 1. You can register the file using a command line, which must be run as an administrator.

Step 2. Writing a command regsvr32.exe + file path and press "Enter"

Step 3. A message will appear saying “Everything went well”, and just restart the computer

That's all, the file is registered, you can try to launch your game or program

Here are some tips that may be useful to you.

  • Place items only in the specified folder (it may be hidden by default). You need to uncheck “Do not show hidden folders” in the display settings.
  • If administrator permission is required when replacing a file, confirm the action.
  • Select only the files that are relevant at the time of downloading and save them to your computer separately. They may still be useful to you. If the problem occurs again, you will quickly restore system functionality.

Many sketches (programs) work with libraries. The library makes it easier to work with a specific module or one of the types of modules. For example, if you want to display text on an LCD display without connecting a library, then you need to transfer several bytes of commands and data to it, which will take several lines of code, and most importantly, you need to know the type of microcontroller under which the LCD display operates, the purpose of the commands it is controlled, know the architecture of its memory, addresses and purpose of registers, for which you will need to find and re-read its datasheet. While when writing code using a library (for example LiquidCrystal_I2C.h), you can display text by calling just one library function: lcd.print("my text");

Before you start using the methods and functions of the library, you need to download (download to your computer), install (place in the desired folder) and to plug (insert the text "#include<файл.h>" into the sketch).

Downloading the library:

If a library is used in our lessons, descriptions or examples, we provide a link to download this library. All our libraries are in a zip archive, but do not rush to get files from the archive, this may not be necessary, because... The Arduino IDE itself can unpack archives and place libraries in the required folders (see below).

If you downloaded the library archive from the site without specifying the path to save the file, then the downloaded (uploaded) file is most likely located in the folder: This computer > Downloads.

Library installation:

After you have downloaded (uploaded) the library to your computer, you need to install it. You can install the library manually or do it using the Arduino IDE:

Installing the library using Arduino IDE:

Enter the menu: Sketch > Connect library > Add .ZIP library... .


In the window that appears, click on the “ This computer " and select the folder " Downloads " If, when downloading a ZIP archive from the site, you specified the path to save the file, then instead of the “Downloads” folder, specify the path to the file.


Select the library ZIP file you downloaded. The file name may not match the library name. Then click on the “ Open » ( Open ).


At this point, the installation of the library is complete, you can start connecting it to the sketch.

Installing the library manually:

Unzip what you downloaded ZIP archive and place the folder (the folder name usually matches the name of the library) from this archive into the folder: This computer > Documentation > Arduino > libraries .


If the Arduino IDE was running (open) during copying, then you need to close all windows of this program, then launch (open) the Arduino IDE and you can start connecting the library to the sketch.

Note: folder libraries there is not only the path indicated above, but also in the Arduino IDE program folder (where is the arduino file .exe). By copying the library to this folder, it will also be installed, but we do not recommend doing this. The fact is that the Arduino IDE program is constantly evolving and the number of its versions is constantly growing. If you want to install a new version of the Arduino IDE, then the libraries located in the This Computer > Documents > Arduino > libraries folder will be available in both the old and new (installed) versions of the Arduino IDE, and the libraries located in the libraries folder Arduino IDE programs of the old version (which were installed previously) will only be available in it (until you copy them to the new one).

Connecting the library:

In order to include the library, you need to write just one line at the beginning of the sketch: "#include<файл.h>", For example:

#include // Connecting the iarduino_4LED library to work with 4 segment LED indicators.

Some libraries work using the methods and functions of other libraries, then you need to connect two libraries, first connect the one whose methods and functions the second one uses, for example:

#include // Connecting the Wire library to work with the I2C bus #include // Connecting the LiquidCrystal_I2C library to work with an LCD display via the I2C bus // The LiquidCrystal_I2C library uses the methods and functions of the Wire library

To work with most libraries, you need to create an object (an instance of the library class) through which their functions and methods will be available, for example:

LiquidCrystal_I2C lcd(0x27,20,4); // lcd is an object of the LiquidCrystal_I2C library // functions and methods of the library are accessed through the object

Instead of lcd, you can write any word or combination of letters and numbers; this is the name of the object through which you can access the methods and functions of the library. If instead of lcd you wrote myLCD, then all methods and functions of the LiquidCrystal_I2C library must be accessed through the object name you specified, for example: myLCD.print("my text");

Examples from libraries:

Most libraries contain examples. These are small sketches (programs) that reveal the functionality of the library. The most convenient way to view examples is using the Arduino IDE. Select menu item: File > Examples , a list will open with the names of libraries that have examples. Hover over the library name and you will see a list of examples contained in it, clicking on an example will lead to the appearance of a new Arduino IDE window with an example sketch.


An alternative way to view the examples is to run the sketch files from the folder:
path > libraries > library name > examples > example name .

Search for libraries:

You can search for libraries yourself, or you can use the functionality of the Arduino IDE.

Select menu item: Sketch > Connect library > Manage libraries... .


" Library Manager ", in which you can find the library you are interested in by entering its name in the search bar; you can additionally set the items "Type" and "Subject".


Clicking on the library description will lead to the appearance of the “ Version " and buttons " Installation " After clicking on the “Install” button, you can start including the library in the sketch "#include<файл.h>".

Once you are comfortable with the Arduino software and have mastered the standard functions, you will probably want to expand the capabilities of your Arduino with additional libraries.

What is a library?

A library is a set of functions designed to make working with various sensors, LCD screens, modules, etc. as easy as possible. For example, the built-in LiquidCrystal library allows you to easily interact with character LCD screens. There are hundreds of additional libraries that can be downloaded online. The standard Arduino libraries and a number of the most commonly used additional libraries are listed in the help. But before you can use additional libraries, you must first install them.

How to install the library

Most often, libraries are laid out in the form of a ZIP archive or just a folder. The name of this folder is the name of the library. Inside the folder there will be a file with the extension .cpp, file with extension .h and also a text file keywords.txt, folder with examples examples and other files required by the library.

Automatic installation

Starting from version 1.0.5, you can install third-party libraries directly in the development environment.

Do not unpack the downloaded archive with the library - leave it as is.

In the Arduino development environment, select the menu Sketch > Import Library. At the very top of the drop-down list, select Add Library(Add library).

A dialog box will appear prompting you to select the library you would like to add. Navigate to the downloaded zip file and open it.

Open the menu again Sketch > Import Library. You should see the new library at the very bottom of the drop-down list. Now the library can be used in programs.

The zip file will already be unpacked in the directory libraries inside your working Arduino folder.

Note: after completing these steps, the library can be fully used in your programs, but examples from the installed library will appear in the menu File > Examples only after restarting the Arduino environment.

Manual installation

Before installing the library, close the Arduino development environment.

Then extract the ZIP archive containing the library. Let's say you install the "ArduinoParty" library - unzip the file ArduinoParty.zip. There should be a folder in it ArduinoParty with files ArduinoParty.cpp And ArduinoParty.h. (If files with the extension .cpp And .h are not in a folder, you need to create one. In this case, you need to create a folder named ArduinoParty and transfer all the files from the ZIP archive into it, for example - ArduinoParty.cpp And ArduinoParty.h).

Drag a folder ArduinoParty to the Arduino libraries directory. On Windows it will be approximately here: "My Documents\Arduino\libraries", for Mac users it is here: "Documents/Arduino/libraries", and on Linux systems the directory " libraries" will be inside the working folder with sketches.

After moving, your library directory should look something like this (under Windows):

My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h My Documents\Arduino\libraries\ArduinoParty\examples ....

or like this (on Mac):

Documents/Arduino/libraries/ArduinoParty/ArduinoParty.cpp Documents/Arduino/libraries/ArduinoParty/ArduinoParty.h Documents/Arduino/libraries/ArduinoParty/examples ...

and similarly on Linux.

Besides files .cpp And .h There may be other files here too - just make sure they are all here now.

(If files .cpp And .h located in the root of the "libraries" folder or nested inside another folder, the downloaded library will not work. For example:

Documents\Arduino\libraries\ArduinoParty.cpp and Documents\Arduino\libraries\ArduinoParty\ArduinoParty\ArduinoParty.cpp

Not a working example.)

Restart the Arduino environment. Make sure the new library appears in the menu Sketch->Import Library.

That's all! You have installed the library!

This guide is published under a Creative Commons Attribution-ShareAlike 3.0 license. The code examples found in this guide are free content.