Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Arduino Libraries

Let's look at how to install a sensor library.

We'll only do one example, but it works pretty much the same for all others.

DHT22

The DHT22 (and DHT11) used to be pretty popular temperature and humidity sensors. They're a bit old-fashioned now but still work fine for our purposes.

dht22

(If you want a more up-to-date sensor the go-to would be the BME280, including air pressure and altitude!)

Installing a library

Since Arduino IDE 2.x the library manager sits neatly on the left side of the window.

Just search for DHT22 and install the first result.

screenshot install dht22

Examples

The Ardunio IDE comes with lots of examples and libraries usually add more.

(Sorry for making you type so much code until now!)

Open

File > Examples > DHT22 > dht22test

adjust the pin and flash it!