projets:2019:stagefevrierubo
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
projets:2019:stagefevrierubo [2019/02/20 14:13] – christian.jacolot | projets:2019:stagefevrierubo [2024/04/16 22:26] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 223: | Ligne 223: | ||
// Serial reading buffer | // Serial reading buffer | ||
- | const byte numChars = 45; | + | const byte numChars = 60; |
char receivedChars[numChars]; | char receivedChars[numChars]; | ||
boolean newData = false; | boolean newData = false; | ||
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 | ||
- | const byte numChars = 45; | + | const byte numChars = 60; |
char receivedChars[numChars]; | char receivedChars[numChars]; | ||
boolean newData = false; | boolean newData = false; | ||
Ligne 369: | Ligne 370: | ||
if (!root.success()) { | if (!root.success()) { | ||
Serial.println(" | Serial.println(" | ||
+ | receivedChars[0] = ' | ||
return; | return; | ||
} | } | ||
Ligne 375: | Ligne 377: | ||
speedServo = root[" | speedServo = root[" | ||
myservo.write(positionServo, | myservo.write(positionServo, | ||
- | } else if (root.containsKey(" | + | } |
- | int ventiloValue = root["motor"]; | + | |
+ | | ||
+ | int ventiloValue = root["ventilo"]; | ||
if (ventiloValue == 1) { | if (ventiloValue == 1) { | ||
ventiloState = HIGH; | ventiloState = HIGH; | ||
Ligne 382: | Ligne 386: | ||
ventiloState = LOW; | ventiloState = LOW; | ||
} | } | ||
- | } else if (root.containsKey(" | + | } |
+ | |||
+ | | ||
int relaiValue = root[" | int relaiValue = root[" | ||
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, | digitalWrite(VENTILOPIN, | ||
} | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | Nodered flow | ||
+ | < | ||
+ | [{" |