Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
two pin two device example added
- Loading branch information
1 parent
181501c
commit ad90160
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// FILE: TwoPin_DS18B20.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.00 | ||
// PURPOSE: two pins for two sensors demo | ||
// DATE: 2014-06-13 | ||
// URL: http://forum.arduino.cc/index.php?topic=216835.msg1764333#msg1764333 | ||
// | ||
// Released to the public domain | ||
// | ||
|
||
#include <OneWire.h> | ||
#include <DallasTemperature.h> | ||
|
||
#define ONE_WIRE_BUS_1 2 | ||
#define ONE_WIRE_BUS_2 4 | ||
|
||
OneWire oneWire_in(ONE_WIRE_BUS_1); | ||
OneWire oneWire_out(ONE_WIRE_BUS_2); | ||
|
||
DallasTemperature sensor_inhouse(&oneWire_in); | ||
DallasTemperature sensor_outhouse(&oneWire_out); | ||
|
||
void setup(void) | ||
{ | ||
Serial.begin(9600); | ||
Serial.println("Dallas Temperature Control Library Demo - TwoPin_DS18B20"); | ||
|
||
sensor_inhouse.begin(); | ||
sensor_outhouse.begin(); | ||
} | ||
|
||
void loop(void) | ||
{ | ||
Serial.print("Requesting temperatures..."); | ||
sensor_inhouse.requestTemperatures(); | ||
sensor_outhouse.requestTemperatures(); | ||
Serial.println(" done"); | ||
|
||
Serial.print("Inhouse: "); | ||
Serial.println(sensor_inhouse.getTempCByIndex(0)); | ||
|
||
Serial.print("Outhouse: "); | ||
Serial.println(sensor_outhouse.getTempCByIndex(0)); | ||
} |