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
projets:2019:stagefevrierubo [2019/02/20 14:19] christian.jacolotprojets:2019:stagefevrierubo [2024/04/16 22:26] (Version actuelle) – modification externe 127.0.0.1
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();
Ligne 417: Ligne 423:
   digitalWrite(VENTILOPIN, ventiloState);   digitalWrite(VENTILOPIN, ventiloState);
 } }
 +</code>
 +
 +
 +Nodered flow
 +<code>
 +[{"id":"3d2aea77.badaf6","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"3f949c8b.e9662c","type":"serial in","z":"3d2aea77.badaf6","name":"Arduino liaison série","serial":"7934b4c5.a4c6ac","x":118.50001525878906,"y":105,"wires":[["58f6c8f2.f84108","ee8168db.c30cd8"]]},{"id":"58f6c8f2.f84108","type":"debug","z":"3d2aea77.badaf6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":708.5,"y":70,"wires":[]},{"id":"ee8168db.c30cd8","type":"json","z":"3d2aea77.badaf6","name":"","property":"payload","action":"","pretty":false,"x":108.49998474121094,"y":204,"wires":[["47a6359d.a05d6c","ad8bab3b.6151e"]]},{"id":"47a6359d.a05d6c","type":"debug","z":"3d2aea77.badaf6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":709.5,"y":162,"wires":[]},{"id":"ad8bab3b.6151e","type":"function","z":"3d2aea77.badaf6","name":"Récupérer Humidity","func":"msg.payload = msg.payload.hum;\nreturn msg;","outputs":1,"noerr":0,"x":156.50001525878906,"y":291,"wires":[["49353fa9.b11378","5aa63008.6e225"]]},{"id":"49353fa9.b11378","type":"ui_chart","z":"3d2aea77.badaf6","name":"","group":"6236518f.ee41e8","order":1,"width":0,"height":0,"label":"Humidité","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":798.5,"y":274.9999694824219,"wires":[[],[]]},{"id":"5aa63008.6e225","type":"switch","z":"3d2aea77.badaf6","name":"Humidité >= 60","property":"payload.state","propertyType":"msg","rules":[{"t":"gte","v":"60","vt":"num"},{"t":"lt","v":"60","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":147.83338928222656,"y":384.333251953125,"wires":[["13b76f6c.0304c9"],["2c7f8898.6e7d38"]]},{"id":"3a206f96.153a9","type":"ui_button","z":"3d2aea77.badaf6","name":"","group":"6236518f.ee41e8","order":3,"width":0,"height":0,"passthru":true,"label":"Arrêter le ventilo","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"str","topic":"","x":512.8333740234375,"y":646.3333740234375,"wires":[[]]},{"id":"902a3c34.bdb6d","type":"serial out","z":"3d2aea77.badaf6","name":"Arduino sortie","serial":"7934b4c5.a4c6ac","x":822.833251953125,"y":400.16668701171875,"wires":[]},{"id":"e06793a6.3b1558","type":"ui_switch","z":"3d2aea77.badaf6","name":"","label":"Automatique","tooltip":"","group":"6236518f.ee41e8","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":328.8333740234375,"y":531.3333740234375,"wires":[["77a8e113.0544f"]]},{"id":"77a8e113.0544f","type":"switch","z":"3d2aea77.badaf6","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":551.8333740234375,"y":552.3333740234375,"wires":[[],[]]},{"id":"13b76f6c.0304c9","type":"function","z":"3d2aea77.badaf6","name":"Démarrer ventilo","func":"msg.payload = \"{\\\"ventilo\\\":1}\\n\"\nreturn msg;","outputs":1,"noerr":0,"x":371.8333740234375,"y":355.66668701171875,"wires":[["902a3c34.bdb6d"]]},{"id":"2c7f8898.6e7d38","type":"function","z":"3d2aea77.badaf6","name":"Arrêter ventilo","func":"msg.payload = \"{\\\"ventilo\\\":0}\\n\"\nreturn msg;","outputs":1,"noerr":0,"x":347.2833251953125,"y":437.73333740234375,"wires":[["902a3c34.bdb6d"]]},{"id":"7934b4c5.a4c6ac","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":true,"responsetimeout":"10000"},{"id":"6236518f.ee41e8","type":"ui_group","z":"","name":"Chambre","tab":"ad170f6e.de74f8","disp":true,"width":"6","collapse":false},{"id":"ad170f6e.de74f8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
 </code> </code>
  
projets/2019/stagefevrierubo.1550668763.txt.gz · Dernière modification : 2024/04/16 22:27 (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki