Cov txheej txheem:

Humidity Sensor Basics: 3 Kauj Ruam
Humidity Sensor Basics: 3 Kauj Ruam

Video: Humidity Sensor Basics: 3 Kauj Ruam

Video: Humidity Sensor Basics: 3 Kauj Ruam
Video: What is humidity? 2024, Kaum ib hlis
Anonim
Vaum Sensor Pib
Vaum Sensor Pib
Vaum Sensor Pib
Vaum Sensor Pib
Vaum Sensor Pib
Vaum Sensor Pib

Nov yog cov lus qhia yooj yim yuav siv DHT 11 sensor module nrog Arduino board.

Khoom siv

  1. DHT11 module
  2. Arduino Uno/nano/thiab lwm yam…
  3. Jumper xov hlau
  4. Pawg mov ci

Kauj ruam 1: Ua Kev Sib Txuas

Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas
Ua Kev Sib Txuas

VCC nkag mus rau 5V chaw nres nkoj ntawm arduino

GND nkag mus rau ib qho hauv av (GND) ntawm arduino

thiab thaum kawg peb muaj Cov Ntaub Ntawv tus pin (tus pin nruab nrab) uas nkag mus rau ib qho ntawm cov koob digital (D2-D13)

Kauj ruam 2: Code Nws

#suav nrog dht DHT;

// Teeb tus pin rau DHT sensor

#define DHT11_PIN 6

void teeb tsa ()

{Serial.begin (115200); Serial.println ("DHT TEST PROGRAM"); Serial.print ("LIBRARY VERSION:"); Serial.println (DHT_LIB_VERSION); Serial.println (); Serial.println ("Hom, / tstatus, / tHumidity (%), / tTemperature (C)"); }

void lub voj ()

{// DISPLAY DATA Serial.print (DHT.humidity, 1); Serial.print (", / t"); Serial.println (DHT.temperature, 1);

ncua (2000);

} // // Kawg NTAWV NTAWV //

Siv Lub Tsev Qiv Ntawv DHT.h cov lej ua kom yooj yim heev, thiab rho tawm qhov kub thiab txias yog ib qho khoom qab zib

Cov av noo tau muab khaws cia hauv DHT.cov huab cua thiab kub hauv DHT. Temperature. Txhua yam koj yuav tsum tau ua yog teeb DHT11_PIN rau tus lej tus lej koj tau ntsaws lub sensor rau hauv

Yog tias koj xav tau kev pab nrog suav nrog kev tso cai siv cov lus qhia saum toj no, vam tias nws yuav pab tau.

Pom zoo: