Devices & Components
Arduino Uno Rev3
Breadboard (generic)
DHT22 Temperature Sensor
Resistor 4.75k ohm
Jumper wires (generic)
Project description
Code
2DHT22 AM2302 Sensor
arduino
Test project
1inary file (no preview
Untitled file
c_cpp
1#include <dht.h> 2 3dht DHT1; 4dht DHT2; 5 6#define DHT22_1_PIN 2 7#define DHT22_2_PIN 3 8 9 10void setup() { 11 // Wait a few seconds between measurements. The DHT22 should not be read at a higher frequency of 12 // about once every 2 seconds. So we add a 5 second delay to cover this. you can change the delay frequency at the end of the code list. 13 Serial.begin(9600); 14 Serial.println("Système en ligne..."); 15 Serial.println("Lecture aux 5 secondes"); 16} 17 18 19 20 21void loop() { 22 23 24 DHT1.read22(DHT22_1_PIN); 25 DHT2.read22(DHT22_2_PIN); 26 27 28 Serial.println("Intérieur"); 29 Serial.print(" Humidité ");Serial.print(DHT1.humidity); Serial.print(" %"); 30 Serial.print(" Température "); Serial.print(DHT1.temperature);Serial.println(" C°"); 31 32 Serial.println("Extérieur"); 33 Serial.print(" Humidité "); Serial.print(DHT2.humidity); Serial.print(" %"); 34 Serial.print(" Température "); Serial.print(DHT2.temperature);Serial.println(" C°"); 35 36 Serial.println("-----------------"); 37 Serial.println(" "); 38 39 delay(5000); // you can change the delay frequency here. 40}
2DHT22 AM2302 Sensor
arduino
Test project
1inary file (no preview
2DHT22 AM2302 Sensor
arduino
Test project
1inary file (no preview
Untitled file
c_cpp
1#include <dht.h> 2 3dht DHT1; 4dht DHT2; 5 6#define DHT22_1_PIN 7 2 8#define DHT22_2_PIN 3 9 10 11void setup() { 12 // Wait 13 a few seconds between measurements. The DHT22 should not be read at a higher frequency 14 of 15 // about once every 2 seconds. So we add a 5 second delay to cover this. 16 you can change the delay frequency at the end of the code list. 17 Serial.begin(9600); 18 19 Serial.println("Système en ligne..."); 20 Serial.println("Lecture aux 5 secondes"); 21} 22 23 24 25 26void 27 loop() { 28 29 30 DHT1.read22(DHT22_1_PIN); 31 DHT2.read22(DHT22_2_PIN); 32 33 34 35 Serial.println("Intérieur"); 36 Serial.print(" Humidité ");Serial.print(DHT1.humidity); 37 Serial.print(" %"); 38 Serial.print(" Température "); Serial.print(DHT1.temperature);Serial.println(" 39 C°"); 40 41 Serial.println("Extérieur"); 42 Serial.print(" Humidité "); 43 Serial.print(DHT2.humidity); Serial.print(" %"); 44 Serial.print(" Température 45 "); Serial.print(DHT2.temperature);Serial.println(" C°"); 46 47 Serial.println("-----------------"); 48 49 Serial.println(" "); 50 51 delay(5000); // you can change the delay frequency 52 here. 53}
Downloadable files
2DHT22 AM2302 Sensor
Test project
2DHT22 AM2302 Sensor
Diagram
Diagram
Comments
Only logged in users can leave comments