scan for 1-Wire devices + code snippet generator DATE: 2015-june-30 URL: http://forum.arduino.cc/index.php?topic=333923
scan for 1-Wire devices + code snippet generator DATE: 2015-june-30 URL: http://forum.arduino.cc/index.php?topic=333923@author Rob Tillaart VERSION: 0.1.02
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
1/** =========================================================================
2 * @example{lineno} oneWireSearch.ino
5 * @brief scan for 1-Wire devices + code snippet generator
7 * URL: http://forum.arduino.cc/index.php?topic=333923
10 * http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
12 * Released to the public domain
14 * 0.1.00 initial version
15 * 0.1.01 first published version
16 * 0.1.02 small output changes
18 * @m_examplenavigation{page_extra_helper_sketches,}
19 * ======================================================================= */
24uint8_t findDevices(int pin) {
31 if (ow.search(address)) {
32 Serial.print("\nuint8_t pin");
33 Serial.print(pin, DEC);
34 Serial.println("[][8] = {");
38 for (uint8_t i = 0; i < 8; i++) {
40 if (address[i] < 0x10) Serial.print("0");
41 Serial.print(address[i], HEX);
42 if (i < 7) Serial.print(", ");
45 } while (ow.search(address));
48 Serial.print("// nr devices found: ");
49 Serial.println(count);
58 "//\n// Start oneWireSearch.ino \n// -----------------------");
62 digitalWrite(22, HIGH);
65 for (uint8_t pin = 2; pin < 37; pin++) { findDevices(pin); }
66 Serial.println("\n//\n// End oneWireSearch.ino \n// ---------------------");
69 digitalWrite(22, LOW);