File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11//
22// FILE: oneWireSearch.ino
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.1.03
4+ // VERSION: 0.1.04
55// PURPOSE: scan for 1-Wire devices + code snippet generator
66// DATE: 2015-june-30
77// URL: http://forum.arduino.cc/index.php?topic=333923
1414// 0.1.01 first published version
1515// 0.1.02 small output changes
1616// 0.1.03 added more explicit range
17+ // 0.1.04 added CRC check
1718
18- // UNO 3 ..20
19+ // UNO 2 ..20
1920// MEGA and others have different range
2021const int startPin = 2 ;
2122const int endPin = 20 ;
@@ -61,7 +62,16 @@ uint8_t findDevices(int pin)
6162 Serial.print (address[i], HEX);
6263 if (i < 7 ) Serial.print (" , " );
6364 }
64- Serial.println (" }," );
65+ Serial.print (" }," );
66+ // CHECK CRC
67+ if (ow.crc8 (address, 7 ) == address[7 ])
68+ {
69+ Serial.println (" \t\t // CRC OK" );
70+ }
71+ else
72+ {
73+ Serial.println (" \t\t // CRC FAILED" );
74+ }
6575 } while (ow.search (address));
6676
6777 Serial.println (" };" );
You can’t perform that action at this time.
0 commit comments