2 #include <DallasTemperature.h>
4 // Data wire is plugged into port 2 on the Arduino
7 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
8 OneWire oneWire(ONE_WIRE_BUS);
10 // Pass our oneWire reference to Dallas Temperature.
11 DallasTemperature sensors(&oneWire);
17 Serial.println("Dallas Temperature IC Control Library Demo");
19 // Start up the library
25 // call sensors.requestTemperatures() to issue a global temperature
26 // request to all devices on the bus
27 Serial.print("Requesting temperatures...");
28 sensors.requestTemperatures(); // Send the command to get temperatures
29 Serial.println("DONE");
31 Serial.print("Temperature for the device 1 (index 0) is: ");
32 Serial.println(sensors.getTempCByIndex(0));