Created
February 1, 2018 21:46
-
-
Save valvoline/9ae55b197b20f64247ade5444111876b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int chk = DHT.read22(DHT22_PIN); | |
switch (chk) | |
{ | |
case DHTLIB_OK: | |
client.print("{ \"temperature\":"); | |
client.print(DHT.temperature-2); | |
client.print(", \"humidity\":"); | |
client.print(DHT.humidity); | |
client.println("}"); | |
break; | |
case DHTLIB_ERROR_CHECKSUM: | |
client.println("{ \"status\" : \"Checksum error\""); | |
break; | |
case DHTLIB_ERROR_TIMEOUT: | |
client.println("{ \"status\" : \"Timeout error\""); | |
break; | |
default: | |
client.println("{ \"status\" : \"Unknown error\""); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment