Skip to content

Commit 326194e

Browse files
author
MichelV
committed
More updating of comments and explanations.
Should realy rename old .pde to .ino
1 parent 93bb7e8 commit 326194e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

examples/Single/Single.pde

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Include the libraries we need
12
#include <OneWire.h>
23
#include <DallasTemperature.h>
34

@@ -13,6 +14,9 @@ DallasTemperature sensors(&oneWire);
1314
// arrays to hold device address
1415
DeviceAddress insideThermometer;
1516

17+
/*
18+
* Setup function. Here we do the basics
19+
*/
1620
void setup(void)
1721
{
1822
// start serial port
@@ -31,14 +35,15 @@ void setup(void)
3135
if (sensors.isParasitePowerMode()) Serial.println("ON");
3236
else Serial.println("OFF");
3337

34-
// assign address manually. the addresses below will beed to be changed
35-
// 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
3640
// by using either oneWire.search(deviceAddress) or individually via
3741
// sensors.getAddress(deviceAddress, index)
42+
// Note that you will need to use your specific address here
3843
//insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
3944

4045
// Method 1:
41-
// search for devices on the bus and assign based on an index. ideally,
46+
// Search for devices on the bus and assign based on an index. Ideally,
4247
// you would do this to initially discover addresses on the bus and then
4348
// use those addresses and manually assign them (see above) once you know
4449
// the devices on your bus (and assuming they don't change).
@@ -47,8 +52,8 @@ void setup(void)
4752
// method 2: search()
4853
// search() looks for the next device. Returns 1 if a new address has been
4954
// returned. A zero might mean that the bus is shorted, there are no devices,
50-
// or you have already retrieved all of them. It might be a good idea to
51-
// check the CRC to make sure you didn't get garbage. The order is
55+
// or you have already retrieved all of them. It might be a good idea to
56+
// check the CRC to make sure you didn't get garbage. The order is
5257
// deterministic. You will always get the same devices in the same order
5358
//
5459
// Must be called before search()
@@ -85,7 +90,9 @@ void printTemperature(DeviceAddress deviceAddress)
8590
Serial.print(" Temp F: ");
8691
Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
8792
}
88-
93+
/*
94+
* Main function. It will request the tempC from the sensors and display on Serial.
95+
*/
8996
void loop(void)
9097
{
9198
// call sensors.requestTemperatures() to issue a global temperature

0 commit comments

Comments
 (0)