1+ // Include the libraries we need
12#include < OneWire . h>
23#include < DallasTemperature . h>
34
@@ -34,14 +35,14 @@ void setup(void)
3435 if (sensors. isParasitePowerMode()) Serial . println(" ON" );
3536 else Serial . println(" OFF" );
3637
37- // assign address manually. the addresses below will beed to be changed
38- // to valid device addresses on your bus. device address can be retrieved
38+ // Assign address manually. The addresses below will beed to be changed
39+ // to valid device addresses on your bus. Device address can be retrieved
3940 // by using either oneWire.search(deviceAddress) or individually via
4041 // sensors.getAddress(deviceAddress, index)
4142 // insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
4243 // outsideThermometer = { 0x28, 0x3F, 0x1C, 0x31, 0x2, 0x0, 0x0, 0x2 };
4344
44- // search for devices on the bus and assign based on an index. ideally ,
45+ // Search for devices on the bus and assign based on an index. Ideally ,
4546 // you would do this to initially discover addresses on the bus and then
4647 // use those addresses and manually assign them (see above) once you know
4748 // the devices on your bus (and assuming they don't change).
@@ -53,8 +54,8 @@ void setup(void)
5354 // method 2: search()
5455 // search() looks for the next device. Returns 1 if a new address has been
5556 // returned. A zero might mean that the bus is shorted, there are no devices,
56- // or you have already retrieved all of them. It might be a good idea to
57- // check the CRC to make sure you didn't get garbage. The order is
57+ // or you have already retrieved all of them. It might be a good idea to
58+ // check the CRC to make sure you didn't get garbage. The order is
5859 // deterministic. You will always get the same devices in the same order
5960 //
6061 // Must be called before search()
@@ -73,7 +74,7 @@ void setup(void)
7374 printAddress(outsideThermometer);
7475 Serial . println();
7576
76- // set the resolution to 9 bit
77+ // set the resolution to 9 bit per device
7778 sensors. setResolution(insideThermometer, TEMPERATURE_PRECISION );
7879 sensors. setResolution(outsideThermometer, TEMPERATURE_PRECISION );
7980
@@ -125,6 +126,9 @@ void printData(DeviceAddress deviceAddress)
125126 Serial . println();
126127}
127128
129+ /*
130+ * Main function, calls the temperatures in a loop.
131+ */
128132void loop (void )
129133{
130134 // call sensors.requestTemperatures() to issue a global temperature
0 commit comments