Last active
December 1, 2015 09:57
-
-
Save vdemay/40a1b924568146b78148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds.search(addr); // address on 1wire bus | |
if (addr[0] == DS18B20) // check we are really using a DS18B20 | |
{ | |
ds.reset(); // rest 1-Wire | |
ds.select(addr); // select DS18B20 | |
ds.write(0x4E); // write on scratchPad | |
ds.write(0x00); // User byte 0 - Unused | |
ds.write(0x00); // User byte 1 - Unused | |
ds.write(0x7F); // set up en 12 bits (0x7F) | |
ds.reset(); // reset 1-Wire | |
ds.select(addr); // select DS18B20 | |
ds.write(0x48); // copy scratchpad to EEPROM | |
delay(15); // wait for end of write | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment