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