Coding a temperature reading system
In this section, we will develop the program to take temperature readers from a sensor. As mentioned, the DS18B20 sensor works with the 1-wire protocol, so we will use the Arduino IDE libraries to program it. Let's get started:
- As the first step, we are going to install the OneWire library. Open the Arduino IDE, and then go to the Tools menu and then Manage Libraries (see Figure 9.8):
- Next, we will search the library by entering the word
OneWire
in the search box. We will install the one created by the 1-wire protocol developers, so please install the one from Jim Studt and his colleagues (see Figure 9.9): - Next, we are going to add the Dallas Temperature library. For this, we enter
ds18b20
in the search box and install the library developed by Miles Burton and collaborators (see Figure 9.10). This library is also available from the sensor producers...