Skip to content

Instantly share code, notes, and snippets.

@vdemay
Created November 17, 2015 11:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdemay/0e98b2519aa1e99b90b4 to your computer and use it in GitHub Desktop.
Save vdemay/0e98b2519aa1e99b90b4 to your computer and use it in GitHub Desktop.
set up temperature resolution on DS18B20
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment