Serial.println("Failed to read from DHT sensor!") Check if any reads failed and exit early (to try again): Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) Reading temperature or humidity takes about 250 milliseconds! ![]() Wait a few seconds between measurements: Begin serial communication at a baud rate of 9600: Initialize DHT sensor for normal 16mhz Arduino: ![]() Set DHT type, uncomment whatever type you're using! * Arduino example code for DHT11, DHT22/AM2302 and DHT21/AM2301 temperature and humidity sensors. You can copy the code by clicking on the button in the top right corner of the code field. You can upload the following example code to your Arduino using the Arduino IDE. Genuine DHTxx sensors are made by ASAIR, you can find their website here.ĭHT11/DHT22 temperature and humidity sensor Arduino example code is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on. Supplies Hardware components 4 pin DHT11 sensorĥ – 10 kΩ resistor (only for 4 pin sensors)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |