mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
sync oneWireSearch with DS18B20_RT
This commit is contained in:
parent
bb8c4a1d7b
commit
d524d01876
@ -4,27 +4,32 @@
|
|||||||
// VERSION: 0.1.5
|
// VERSION: 0.1.5
|
||||||
// PURPOSE: scan for 1-Wire devices + code snippet generator
|
// PURPOSE: scan for 1-Wire devices + code snippet generator
|
||||||
// DATE: 2015-june-30
|
// DATE: 2015-june-30
|
||||||
|
// URL: https://github.com/RobTillaart/DS18B20_RT
|
||||||
// URL: http://forum.arduino.cc/index.php?topic=333923
|
// URL: http://forum.arduino.cc/index.php?topic=333923
|
||||||
//
|
//
|
||||||
// inspired by http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
|
// inspired by http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
|
||||||
//
|
//
|
||||||
// Released to the public domain
|
|
||||||
//
|
|
||||||
// 0.1.00 initial version
|
|
||||||
// 0.1.01 first published version
|
|
||||||
// 0.1.02 small output changes
|
|
||||||
// 0.1.03 added more explicit range
|
|
||||||
// 0.1.04 added CRC check
|
|
||||||
// 0.1.5 fix do while loop (thanks pzygielo)
|
|
||||||
|
|
||||||
// UNO 2..20
|
|
||||||
// MEGA and others have different range
|
// HISTORY
|
||||||
|
// 0.1.00 initial version
|
||||||
|
// 0.1.01 first published version
|
||||||
|
// 0.1.02 small output changes
|
||||||
|
// 0.1.03 added more explicit range
|
||||||
|
// 0.1.04 added CRC check
|
||||||
|
// 0.1.5 fix do while loop (thanks pzygielo)
|
||||||
|
|
||||||
|
|
||||||
|
// UNO has pin 2..20
|
||||||
|
// MEGA and others have different range
|
||||||
|
|
||||||
const int startPin = 2;
|
const int startPin = 2;
|
||||||
const int endPin = 20;
|
const int endPin = 20;
|
||||||
|
|
||||||
|
|
||||||
#include <OneWire.h>
|
#include <OneWire.h>
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
@ -37,10 +42,12 @@ void setup()
|
|||||||
Serial.println("\n//\n// End oneWireSearch.ino \n//");
|
Serial.println("\n//\n// End oneWireSearch.ino \n//");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t findDevices(int pin)
|
uint8_t findDevices(int pin)
|
||||||
{
|
{
|
||||||
OneWire ow(pin);
|
OneWire ow(pin);
|
||||||
@ -48,7 +55,6 @@ uint8_t findDevices(int pin)
|
|||||||
uint8_t address[8];
|
uint8_t address[8];
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
|
|
||||||
|
|
||||||
if (ow.search(address))
|
if (ow.search(address))
|
||||||
{
|
{
|
||||||
Serial.print("\nuint8_t pin");
|
Serial.print("\nuint8_t pin");
|
||||||
@ -84,3 +90,7 @@ uint8_t findDevices(int pin)
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user