Installing the sensor-specific Arduino library

After the hardware connections have been understood, the next step is to start developing the software part. When using sensors, usually most sensor devices need an additional piece of driver software in order to read the signals from the sensor device.

In the Arduino parlance, these software drivers are usually available as Arduino libraries. Most sensors (barring some) have their software drivers built and published online.

These Arduino libraries are available for free download via the Arduino IDE. In this section, the general approach for finding and installing an appropriate Arduino library for the DHT11 temperature sensor will be discussed. These steps can be reused for other sensors as well.

Install the DHT11 library for using the DHT11 temperature sensor with Arduino UNO. This library is required in order to include the DHT.h file in the Arduino sketch described in the next section.

In general, the following steps should be followed in order to use a header file in an Arduino sketch:

  1. Launch the Arduino IDE.
  2. Navigate to Sketch | Include Library |Manage Libraries....
  3. The Library Manager window will pop up.
  4. In the Library Manager window, search for the keyword DHT in the textbox auto-populated with the phrase, Filter your search....
  5. Once the library is listed, go ahead and install it.

After installation, the library should appear as INSTALLED in this list, as shown in the following screenshot:

Figure 7: The DHT11 Arduino library

The preceding library has been used while writing the code in this book. Similarly, for other sensors, you should use the method explained previously for utilizing the sensor-specific header files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.117.109