![]() Serial.println("Error 3: DHT checksum error.") Serial.println("Error 2: DHT start condition 2 not met.") Serial.println("Error 1: DHT start condition 1 not met.") Must call InitDHT once (in "setup()" is usual) before Fills global array dht_dpin, and bGlobalErr, which ReadDHT() //This is the "heart" of the program. Serial.println("Humidity and temperature\n\n") ĭelay(700) //Wait rest of 1000ms recommended delay before InitDHT() //Do what's necessary to prepare for reading DHT from 14 to 4īyte bGlobalErr //for passing error code back from complex functions.īyte dht_dat //Array to hold the bytes sent from sensor. ![]() where if dht_dpin is 14, sensor is on digital line 14, aka analog 0 Other parts of code restrict us to using even though we are using it as a digital pin. Just "huffing" on the sensor from deeply filled lungs should show the software with the sensor on a different line, or for a DHT22. You should not need to change anything except the next line to use Only 3 wires are involved: Vcc, ground, and a single data connection of an Aosong DHT11 unit to the nuelectronics datalogging nuelectronics site, and visual inspection simply provides for easy Sensor attached to P4 (nuelectonics shield)/ analog 0, aka digital 14. from, complied with ver 0018 of the Arduino environment This code works with a DHT11 humidity/ temperature sensing module See the web-page cited above for latest news. the comments may not yet be EXACTLY right. case of the DHT11, I believe the second and fourth bytes are Believed to generally apply to DHT11 as well, except in the Comments on this based on Aosong AM2302, aka DHT22, datasheet. ![]() DHT aka Aosong AM2302, and there's an AM2303 which "DHT" from sensor's names: DHT11, DHT22. "bit" is used in the narrow, computer "1 or 0" This is a re-written DHT11/ DHT22 reading code. It's over commented unfortunately, and I added one where I changed the pin used. On both pins I do get an checksum-error every 60-70 readings though.Ĭode used found at DHT11 humidity and temperature sensor - ar3ne1humDHT11 I've got other plans for the analog pins, connected the DHT data pin to pin 4 of my duino, changed the program accordingly and it works fine. It shouldn't matter which arduino-pin you use, in an example I found it was connected to pin 14 (or analog 0). Just bought one, only have an 328-duino though.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |