Outils pour utilisateurs

Outils du site


projets:2019:stagefevrierubo

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
Prochaine révisionLes deux révisions suivantes
projets:2019:stagefevrierubo [2019/02/20 14:19] christian.jacolotprojets:2019:stagefevrierubo [2019/02/20 15:09] christian.jacolot
Ligne 307: Ligne 307:
 #define DHTTYPE DHT11   // DHT 11 #define DHTTYPE DHT11   // DHT 11
 DHT dht(DHTPIN, DHTTYPE); DHT dht(DHTPIN, DHTTYPE);
 +VarSpeedServo myservo;
  
 unsigned long time; unsigned long time;
Ligne 314: Ligne 315:
 int relayState = LOW; int relayState = LOW;
 int ventiloState = LOW; int ventiloState = LOW;
- 
-VarSpeedServo myservo; 
  
 int positionServo = 0; int positionServo = 0;
 int speedServo = 100; int speedServo = 100;
 +
 +long checkDHT = 2000;
  
 // Serial reading buffer // Serial reading buffer
Ligne 369: Ligne 370:
     if (!root.success()) {     if (!root.success()) {
       Serial.println("parseObject() failed");       Serial.println("parseObject() failed");
 +      receivedChars[0] = '\0';
       return;       return;
     }     }
Ligne 375: Ligne 377:
       speedServo = root["servo"][1];       speedServo = root["servo"][1];
       myservo.write(positionServo, speedServo, true);       myservo.write(positionServo, speedServo, true);
-    } else if (root.containsKey("ventilo")) {+    } 
 +     
 +    if (root.containsKey("ventilo")) {
       int ventiloValue = root["ventilo"];       int ventiloValue = root["ventilo"];
       if (ventiloValue == 1) {       if (ventiloValue == 1) {
Ligne 382: Ligne 386:
         ventiloState = LOW;         ventiloState = LOW;
       }                   }            
-    } else if (root.containsKey("relai")) {+    } 
 +     
 +    if (root.containsKey("relai")) {
       int relaiValue = root["relai"];       int relaiValue = root["relai"];
       if (relaiValue == 1) {       if (relaiValue == 1) {
Ligne 396: Ligne 402:
   }   }
   diff = millis() - time;   diff = millis() - time;
-  if (diff >= 2000) {+  if (diff >= checkDHT) {
     time = millis();     time = millis();
     float h = dht.readHumidity();     float h = dht.readHumidity();
projets/2019/stagefevrierubo.txt · Dernière modification : 2024/04/16 22:26 de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki