Skip to content

Instantly share code, notes, and snippets.

@codemee
Last active August 11, 2017 01:51
Show Gist options
  • Save codemee/9df289a4e098849cd21cc94bb75991fb to your computer and use it in GitHub Desktop.
Save codemee/9df289a4e098849cd21cc94bb75991fb to your computer and use it in GitHub Desktop.
DHT11 library original checksum code
// WRITE TO RIGHT VARS
// as bits[1] and bits[3] are allways zero they are omitted in formulas.
humidity = bits[0];
temperature = bits[2];
uint8_t sum = bits[0] + bits[2];
if (bits[4] != sum) return DHTLIB_ERROR_CHECKSUM;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment