Capteur de t° et d'humidité DHT11 ST052
Code : 35212
Ce capteur de température et d'humidité basé sur le circuit DHT11 communique avec un microcontrôleur type Arduino ou compatible via une sortie digitale.
2,92 € HT
3,50 € TTC
En stock
Avis du site
Le programme de la fiche technique ne marche pas. Ci-dessous un programme qui marche sur Arduino UNO: int DHpin = 8;
byte dat [5];
byte read_data () {
byte data=0;
for (int i = 0; i < 8; i ++) {
while (digitalRead (DHpin) == LOW);
delayMicroseconds (40);
if (digitalRead (DHpin) == HIGH)
data |= (1 << (7-i));
while (digitalRead (DHpin) == HIGH);
}
return data;
}
void start_test () {
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, LOW);
delay (30);
digitalWrite (DHpin, HIGH);
delayMicroseconds (10);
pinMode (DHpin, INPUT);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (50);
while (digitalRead (DHpin) == LOW);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (80);
for (int i = 0; i < 5; i ++)
dat[i] = read_data ();
delayMicroseconds(50);
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, HIGH);
}
void setup () {
Serial.begin (9600);
}
void loop () {
start_test ();
Serial.print ("Current humdity =");
Serial.print (dat [0], DEC);
Serial.print ('.');
Serial.print (dat [1], DEC);
Serial.println ('%');
Serial.print ("Current temperature =");
Serial.print (dat [2], DEC);
Serial.print ('.');
Serial.print (dat [3], DEC);
Serial.println ('C');
Serial.println("---------------------------");
delay (1200);
}
user_deleted
- 4 août 2020
Le programme de la fiche technique ne marche pas. Ci-dessous un programme qui marche sur Arduino UNO: int DHpin = 8;
byte dat [5];
byte read_data () {
byte data=0;
for (int i = 0; i < 8; i ++) {
while (digitalRead (DHpin) == LOW);
delayMicroseconds (40);
if (digitalRead (DHpin) == HIGH)
data |= (1 << (7-i));
while (digitalRead (DHpin) == HIGH);
}
return data;
}
void start_test () {
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, LOW);
delay (30);
digitalWrite (DHpin, HIGH);
delayMicroseconds (10);
pinMode (DHpin, INPUT);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (50);
while (digitalRead (DHpin) == LOW);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (80);
for (int i = 0; i < 5; i ++)
dat[i] = read_data ();
delayMicroseconds(50);
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, HIGH);
}
void setup () {
Serial.begin (9600);
}
void loop () {
start_test ();
Serial.print ("Current humdity =");
Serial.print (dat [0], DEC);
Serial.print ('.');
Serial.print (dat [1], DEC);
Serial.println ('%');
Serial.print ("Current temperature =");
Serial.print (dat [2], DEC);
Serial.print ('.');
Serial.print (dat [3], DEC);
Serial.println ('C');
Serial.println("---------------------------");
delay (1200);
}
user_deleted
- 4 août 2020
Le programme de la fiche technique ne marche pas. Ci-dessous un programme qui marche sur Arduino UNO: int DHpin = 8;
byte dat [5];
byte read_data () {
byte data=0;
for (int i = 0; i < 8; i ++) {
while (digitalRead (DHpin) == LOW);
delayMicroseconds (40);
if (digitalRead (DHpin) == HIGH)
data |= (1 << (7-i));
while (digitalRead (DHpin) == HIGH);
}
return data;
}
void start_test () {
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, LOW);
delay (30);
digitalWrite (DHpin, HIGH);
delayMicroseconds (10);
pinMode (DHpin, INPUT);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (50);
while (digitalRead (DHpin) == LOW);
while (digitalRead (DHpin) == HIGH);
//delayMicroseconds (80);
for (int i = 0; i < 5; i ++)
dat[i] = read_data ();
delayMicroseconds(50);
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, HIGH);
}
void setup () {
Serial.begin (9600);
}
void loop () {
start_test ();
Serial.print ("Current humdity =");
Serial.print (dat [0], DEC);
Serial.print ('.');
Serial.print (dat [1], DEC);
Serial.println ('%');
Serial.print ("Current temperature =");
Serial.print (dat [2], DEC);
Serial.print ('.');
Serial.print (dat [3], DEC);
Serial.println ('C');
Serial.println("---------------------------");
delay (1200);
}
user_deleted
- 4 août 2020