Skip to content

Instantly share code, notes, and snippets.

@codemee
Created August 11, 2017 01:52
Show Gist options
  • Save codemee/5459a12bb166446ca7c52c0cd2a33ed2 to your computer and use it in GitHub Desktop.
Save codemee/5459a12bb166446ca7c52c0cd2a33ed2 to your computer and use it in GitHub Desktop.
DHT11 modified checksum code
// add bits[1] and bits[3] back to formulas to compute correct checksum.
humidity = bits[0];
temperature = bits[2];
uint8_t sum = bits[0] + bits[1] + bits[2] + bits[3];
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