Temperature & Humidity Module

(25 customer reviews)

$5.95

18 in stock

Description

Temperature and Humidity Sensor Module Code


/* SETUP

Temp-Humidity  Arduino
GND     -      GND
DATA    -      D8
VCC     -      5V
*/
 
int DHpin = 8;
byte dat [5];
byte read_data () {
  byte data;
  for (int i = 0; i < 8; i ++) {
    if (digitalRead (DHpin) == LOW) {
      while (digitalRead (DHpin) == LOW); // wait for 50us
      delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'
      if (digitalRead (DHpin) == HIGH)
        data |= (1 << (7-i)); // high front and low in the post
      while (digitalRead (DHpin) == HIGH); // data '1 ', wait for the next one receiver
     }
  }
return data;
}
 
void start_test () {
  digitalWrite (DHpin, LOW); // bus down, send start signal
  delay (30); // delay greater than 18ms, so DHT11 start signal can be detected
 
  digitalWrite (DHpin, HIGH);
  delayMicroseconds (40); // Wait for DHT11 response
 
  pinMode (DHpin, INPUT);
  while (digitalRead (DHpin) == HIGH);
  delayMicroseconds (80); // DHT11 response, pulled the bus 80us
  if (digitalRead (DHpin) == LOW);
  delayMicroseconds (80); // DHT11 80us after the bus pulled to start sending data
 
  for (int i = 0; i < 4; i ++) // receive temperature and humidity data, the parity bit is not considered
    dat[i] = read_data ();
 
  pinMode (DHpin, OUTPUT);
  digitalWrite (DHpin, HIGH); // send data once after releasing the bus, wait for the host to open the next Start signal
}
 
void setup () {
  Serial.begin (9600);
  pinMode (DHpin, OUTPUT);
}
 
void loop () {
  start_test ();
  Serial.print ("Current humdity = ");
  Serial.print (dat [0], DEC); // display the humidity-bit integer;
  Serial.print ('.');
  Serial.print (dat [1], DEC); // display the humidity decimal places;
  Serial.println ('%');
  Serial.print ("Current temperature = ");
  Serial.print (dat [2], DEC); // display the temperature of integer bits;
  Serial.print ('.');
  Serial.print (dat [3], DEC); // display the temperature of decimal places;
  Serial.println ('C');
  delay (100);
}

 

Additional information

Weight 0.003 kg
  1. Hockaw

    lipitor online buy generic atorvastatin buy generic atorvastatin 10mg

  2. Geriyc

    buy baycip sale – cost ethambutol 600mg purchase augmentin pills

  3. Lrssxj

    cipro cost – oral amoxiclav augmentin ca

  4. Zgqyjf

    buy ciprofloxacin medication – cheap trimox 250mg
    cheap erythromycin 250mg

  5. Gqgqvv

    buy generic metronidazole online – buy zithromax tablets buy zithromax 500mg

  6. Bmsfao

    ivermectin online pharmacy – co-amoxiclav generic tetracycline ca

  7. Tlwjdg

    cost valtrex 500mg – nemasole order zovirax 400mg tablet

  8. Ptqgcs

    buy generic ampicillin over the counter buy cheap amoxil amoxicillin sale

  9. Qviwiw

    buy flagyl 200mg generic – cleocin 300mg price buy generic azithromycin over the counter

  10. Delfkf

    buy lasix 40mg for sale – oral tacrolimus 1mg buy captopril 25 mg online

  11. Xfgyzu

    purchase glucophage generic – order duricef 500mg for sale lincocin medication

  12. Gxnxay

    how to get clozaril without a prescription – frumil 5 mg tablet famotidine 40mg tablet

  13. Xsngaw

    retrovir online buy – buy roxithromycin online allopurinol 300mg generic

  14. Rwabrr

    purchase clomipramine for sale – how to buy tofranil order doxepin 75mg online

  15. Nlwixc

    buy quetiapine 100mg – purchase fluvoxamine pill where can i buy eskalith

  16. Ecnvry

    cheap hydroxyzine 10mg – buy fluoxetine 40mg sale buy amitriptyline 10mg without prescription

  17. Qxqxig

    clavulanate cost – order zyvox 600mg without prescription buy cipro 500mg without prescription

  18. Qdferf

    generic amoxil – keflex over the counter purchase baycip

  19. Zntokv

    cost zithromax – buy flagyl 200mg sale buy ciprofloxacin pills

  20. Fiyrhu

    cleocin online – cleocin oral chloromycetin cost

  21. Nhbdkl

    ivermectin 6 mg for humans – buy generic eryc online order cefaclor 500mg

  22. Toqltn

    buy ventolin online – advair diskus inhalator cost buy theo-24 Cr 400 mg sale

  23. Wftafk

    methylprednisolone for sale – azelastine price order azelastine 10 ml nasal spray

  24. Vrhztu

    clarinex cost – purchase flixotide generic order ventolin 4mg online cheap

  25. Ufdred

    micronase 2.5mg ca – order forxiga 10 mg sale order forxiga

Add a review

Your email address will not be published. Required fields are marked *