sync oneWireSearch with DS18B20_RT

This commit is contained in:
Rob Tillaart 2023-05-21 12:49:37 +02:00
parent bb8c4a1d7b
commit d524d01876

View File

@ -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 --