Capteur Humidité Avec Contacteur - Français - Arduino Forum

capteur humidité avec contacteur International Français April 4, 2021, 8:33am 1

Bonjour, Je souhaiterai allumer ou éteindre un ventilateur suivant le pourcentage d humidité dans l air. Je ne trouve pas le problème dans le programme.. Mais le contacteur ne change pas d état... Si vous voyez quelque chose.. help

MAMIE.ino (1.3 KB)

April 4, 2021, 8:39am 2

Bonjour,

Pourquoi mettre une chaine de caractère ici?

  if ("Humidity >59.00"){

C'est tout simplement

  if (Humidity >59.00){

Mets ton code entre balises de code

April 4, 2021, 8:43am 3

Bonjour, merci pour votre réponses. si je l écrit comme vous me le dite, j ai une erreur qui apparait:

^~~~~~~~ exit status 1 'Humidity' was not declared in this scope

April 4, 2021, 9:00am 4

Code:

// Install GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors in arduino/librairies // Install GitHub - adafruit/Adafruit_Sensor: Common sensor library in arduino/Adafruit_Sensor #include "DHT.h" #define DHTPIN 2 #define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() { Serial.begin(9600); Serial.println("DHTxx test!"); dht.begin(); pinMode(9,OUTPUT); } void loop() {

delay(2000);

float h = dht.readHumidity(); float t = dht.readTemperature(); float f = dht.readTemperature(true);

if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); return; }

if (Humidity >59.00){ digitalWrite(9, HIGH); }

if (Humidity <59.00){ digitalWrite(9, LOW); }

// Calcul de l'indice de temperature en Farenheit float hif = dht.computeHeatIndex(f, h); // Calcul de l'indice de temperature en Celsius float hic = dht.computeHeatIndex(t, h, false);

//Affichages : Serial.print("Humidite: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t"); Serial.print("Indice de temperature: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.println(" *F");

}

April 4, 2021, 9:16am 5

C'est le nom de la variable qu'il faut mettre. Elle s'appelle h

if (h >59.00){

Mets ton code entre balises de code.

April 4, 2021, 9:19am 6

toujours le meme probleme:

MAMIE:41:16: error: expected primary-expression before ')' token

if (h <59.00%){

^

exit status 1

expected primary-expression before ')' token

April 4, 2021, 9:30am 7

merci pour les infos:

// Install https://github.com/adafruit/DHT-sensor-library in arduino/librairies // Install https://github.com/adafruit/Adafruit_Sensor in arduino/Adafruit_Sensor #include "DHT.h" #define DHTPIN 2    #define DHTTYPE DHT11  DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); Serial.println("DHTxx test!"); dht.begin(); pinMode(9,OUTPUT); } void loop() { delay(2000); float h = dht.readHumidity(); float t = dht.readTemperature(); float f = dht.readTemperature(true); if (isnan(h) || isnan(t) || isnan(f)) {   Serial.println("Failed to read from DHT sensor!");   return; }   if (h >59.00%){   digitalWrite(9, HIGH);   }     if (h <59.00%){   digitalWrite(9, LOW);   }   // Calcul de l'indice de temperature en Farenheit float hif = dht.computeHeatIndex(f, h); // Calcul de l'indice de temperature en Celsius float hic = dht.computeHeatIndex(t, h, false); //Affichages : Serial.print("Humidite: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t"); Serial.print("Indice de temperature: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.println(" *F"); } April 4, 2021, 9:39am 8

ca y est! merci merci beaucoup

August 2, 2021, 9:39am 9

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.

Topic Replies Views Activity
programme capteur d'humidité Français 3 1743 May 6, 2021
Problème de code Français 25 3302 May 6, 2021
(projet arrosage) Question par rapport au programme de la pompe Français 17 976 May 6, 2021
à lock Français 6 1134 May 6, 2021
Controllo umidità incubatrice Software 11 3096 May 7, 2021
Unfortunately, your browser is unsupported. Please switch to a supported browser to view rich content, log in and reply.

Tag » Arduino Isnan(h)