DHTxx-Utiliser

De MCHobby - Wiki
Révision datée du 16 avril 2013 à 20:29 par Admin (discussion | contributions) (Page créée avec « {{DHTxx-NAV}} To test the sketch, we'll use an Arduino. You can use any micrcontroller that can do microsecond timing, but since its a little tricky to code it up, we sugges... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche

To test the sketch, we'll use an Arduino. You can use any micrcontroller that can do microsecond timing, but since its a little tricky to code it up, we suggest verifying the wiring and sensor work with an Arduino to start.

Begin by downloading the DHT library from our github repository. To download, click the DOWNLOADS button in the top right corner. Rename the uncompressed folder DHT and make sure that it contains the dht.cpp file and others. Then drag the DHT folder into the arduinosketchfolder/libraries/ folder. You may have to create that libraries sub-folder if it doesnt exist. Restart the IDE

Now load up the Examples->DHT->DHTtester sketch

DHTxx-Utiliser-00.jpg

If you're using a DHT11 sensor, comment out the line that sets the type:

//#define DHTTYPE DHT22   // DHT 22  (AM2302)

and uncomment the line that says:

#define DHTTYPE DHT11   // DHT 11

This will make the data appear correctly for the correct sensor. Upload the sketch!

DHTxx-Utiliser-01.jpg

You should see the temperature and humidity. You can see changes by breathing onto the sensor (like you would to fog up a window) which should increase the humidity.


Source: DHTxx Sensors réalisé par LadyAda pour AdaFruit Industries

Créé par LadyAda pour AdaFruit Indrustries.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.