Now, you can start Arduino IDE and inside “File” tab, under “Examples”, you can find “OneWire” library.
WHAT IS ARDUINO LIBRARY?
Arduino library allows us to replace long and complex lines of code with simple functions. . Besides it will simplify and shorten our work greatly, we don’t need to face details and problems with modules/sensors, neither be an advanced C/C++ language user.
Worldwide users write libraries and share them over the internet as open-software. Good spot for downloading libraries is GitHub, and every decent library contains one or more examples and file which explains how to use individual functions found in that particular library. To use the library, it is required to install Arduino IDE.
HOW TO INSTALL THE LIBRARY?
Let’s show it with DHT11 library example on Mac OS X and Arduino IDE 1.0.5. The same procedure can be used with other operating systems and versions of Arduino IDE.
1. Download DHT11 or library you want to install and remember the folder in which you saved it. The library will be a .zip file.
2. Open the folder which contains previously downloaded library. Check if there are any letters which aren’t ASCII inside the name of the file or if it starts with a number. If there are some, right click on a .zip file, then left click on “Rename” and rename it to some allowed title. Usually, you’ll find that the name contains a “-” symbol (which isn’t allowed), and delete it.
3. Inside Arduino IDE select “Sketch” menu, then “Import Library…” and “Add Library…”. Find the folder and .zip file previously downloaded and open it.
4. If you get a similar window as in the picture below, go back to step 2.
The correctly installed library will show this message:
You can find examples of the library you installed under “File” menu, “Examples” -name of the library. In our case, it’s “DHT11”.
Older Arduino IDE versions do not have an “Add library” option. If you are using an older version, or from some other reason you want to manually install the library, you can use instructions below.
We will create an example of manual installation inside Windows 7 operating system, although it is the same for every version of Windows. Follow the first two steps out of tutorial above, but instead of renaming the .zip file in step two, execute it first, then rename it in the same way as shown in that step.
Copy the executed and renamed folder to /My Documents/Arduino/libraries.
If you had Arduino IDE open during the installation, after copying of the library, restart the Arduino IDE to be able to use the previously installed library.
The procedure is identical to the one for Windows OS, and folder “libraries” can be found in /Documents/Arduino/libraries. Copy the executed and renamed folder here and restart Arduino IDE after.
The installation principle is same again: it’s required to copy the folder which includes the library to “libraries” folder inside Arduino. Execution is different, that’s why we will go through a whole installation process. If you followed the installation of Arduino IDE for Linux, you should remember that we installed it in /opt/arduino-1.6.0.
1. We will install OneWire library from GitHub. Click on “Download ZIP” will save us file “arduino-OneWire.zip” to “Downloads” folder.
2. We’ll open terminal and execute following commands:
mv arduino-OneWire.zip OneWire.zip
This will rename the name of the .zip file to “OneWire.zip”. It is necessary because the name of the library needs to be ASCII. After, we’ll unzip and copy new .zip file to Arduino libraries by typing:
Products used in this tutorial
No products found