3 /* DS18S20 Temperature chip i/o */
5 OneWire ds(8); // on pin 10
17 if ( !ds.search(addr)) {
18 Serial.print("No more addresses.\n");
25 for( i = 0; i < 8; i++) {
26 Serial.print(addr[i], HEX);
30 if ( OneWire::crc8( addr, 7) != addr[7]) {
31 Serial.print("CRC is not valid!\n");
35 if ( addr[0] != 0x10) {
36 Serial.print("Device is not a DS18S20 family device.\n");
40 // The DallasTemperature library can do all this work for you!
44 ds.write(0x44,1); // start conversion, with parasite power on at the end
46 delay(1000); // maybe 750ms is enough, maybe not
47 // we might do a ds.depower() here, but the reset will take care of it.
51 ds.write(0xBE); // Read Scratchpad
54 Serial.print(present,HEX);
56 for ( i = 0; i < 9; i++) { // we need 9 bytes
58 Serial.print(data[i], HEX);
61 Serial.print(" CRC=");
62 Serial.print( OneWire::crc8( data, 8), HEX);