RemyCluze 5 years ago
parent
commit
3b857929e2
1 changed files with 25 additions and 56 deletions
  1. 25 56
      Soft/MCUnode/Peristatique/Peristatique.ino

+ 25 - 56
Soft/MCUnode/Peristatique/Peristatique.ino

@@ -1,38 +1,4 @@
-/*************************************************************
-  Download latest Blynk library here:
-    https://github.com/blynkkk/blynk-library/releases/latest
 
 
-  Blynk is a platform with iOS and Android apps to control
-  Arduino, Raspberry Pi and the likes over the Internet.
-  You can easily build graphic interfaces for all your
-  projects by simply dragging and dropping widgets.
-
-    Downloads, docs, tutorials: http://www.blynk.cc
-    Sketch generator:           http://examples.blynk.cc
-    Blynk community:            http://community.blynk.cc
-    Follow us:                  http://www.fb.com/blynkapp
-                                http://twitter.com/blynk_app
-
-  Blynk library is licensed under MIT license
-  This example code is in public domain.
-
- *************************************************************
-  This example runs directly on NodeMCU.
-
-  Note: This requires ESP8266 support package:
-    https://github.com/esp8266/Arduino
-
-  Please be sure to select the right NodeMCU module
-  in the Tools -> Board menu!
-
-  For advanced settings please follow ESP examples :
-   - ESP8266_Standalone_Manual_IP.ino
-   - ESP8266_Standalone_SmartConfig.ino
-   - ESP8266_Standalone_SSL.ino
-
-  Change WiFi ssid, pass, and Blynk auth token to run :)
-  Feel free to apply it to any other example. It's simple!
- *************************************************************/
 
 
 /* Comment this out to disable prints and save space */
 /* Comment this out to disable prints and save space */
 #define BLYNK_PRINT Serial
 #define BLYNK_PRINT Serial
@@ -59,24 +25,23 @@ char pass[] = "566C61F61F9C925C9F3D7D79E6";
 #define POMPE3 2
 #define POMPE3 2
 #define POMPE4 3
 #define POMPE4 3
 
 
-const int PINPOMPE1 = 2;
-const int PINPOMPE2 = 3;
+#define FACTEURML 635
+
+const int PINPOMPE1 = 16;
+const int PINPOMPE2 = 5;
 const int PINPOMPE3 = 4;
 const int PINPOMPE3 = 4;
-const int PINPOMPE4 = 5;
+const int PINPOMPE4 = 0;
 
 
-float ML1 = 0.1;
-float ML2 = 0;
-float ML3 = 0;
-float ML4 = 0;
+float ML1 = 0.0;
+float ML2 = 0.0;
+float ML3 = 0.0;
+float ML4 = 0.0;
 
 
 bool AUTO1 = false;
 bool AUTO1 = false;
 bool AUTO2 = false;
 bool AUTO2 = false;
 bool AUTO3 = false;
 bool AUTO3 = false;
 bool AUTO4 = false;
 bool AUTO4 = false;
 
 
-
-
-
 //************************************************************************
 //************************************************************************
 //                Fonction
 //                Fonction
 //************************************************************************
 //************************************************************************
@@ -88,9 +53,9 @@ void Active(int pompe, float ml) {
   char message[30];
   char message[30];
   switch (pompe) {
   switch (pompe) {
     case (POMPE1):
     case (POMPE1):
-      //digitalWrite(PINPOMPE1,HIGH);
-      //delay(FACTEURML*ml);
-      //digitalWrite(PINPOMPE1,LOW);
+      digitalWrite(PINPOMPE1,LOW);
+      delay(FACTEURML*ml);
+      digitalWrite(PINPOMPE1,HIGH);
       Serial.print("Distribue pompe1 : ");
       Serial.print("Distribue pompe1 : ");
       Serial.print(ml);
       Serial.print(ml);
       Serial.println("ml");
       Serial.println("ml");
@@ -98,9 +63,9 @@ void Active(int pompe, float ml) {
       Blynk.notify(message);
       Blynk.notify(message);
       break;
       break;
     case (POMPE2):
     case (POMPE2):
-      //digitalWrite(PINPOMPE2,HIGH);
-      //delay(FACTEURML*ml);
-      //digitalWrite(PINPOMPE2,LOW);
+      digitalWrite(PINPOMPE2,LOW);
+      delay(FACTEURML*ml);
+      digitalWrite(PINPOMPE2,HIGH);
       Serial.print("Distribue pompe2 : ");
       Serial.print("Distribue pompe2 : ");
       Serial.print(ml);
       Serial.print(ml);
       Serial.println("ml");
       Serial.println("ml");
@@ -108,9 +73,9 @@ void Active(int pompe, float ml) {
       Blynk.notify(message);
       Blynk.notify(message);
       break;
       break;
     case (POMPE3):
     case (POMPE3):
-      //digitalWrite(PINPOMPE3,HIGH);
-      //delay(FACTEURML*ml);
-      //digitalWrite(PINPOMPE3,LOW);
+      digitalWrite(PINPOMPE3,LOW);
+      delay(FACTEURML*ml);
+      digitalWrite(PINPOMPE3,HIGH);
       Serial.print("Distribue pompe3 : ");
       Serial.print("Distribue pompe3 : ");
       Serial.print(ml);
       Serial.print(ml);
       Serial.println("ml");
       Serial.println("ml");
@@ -118,9 +83,9 @@ void Active(int pompe, float ml) {
       Blynk.notify(message);
       Blynk.notify(message);
       break;
       break;
     case (POMPE4):
     case (POMPE4):
-      //digitalWrite(PINPOMPE3,HIGH);
-      //delay(FACTEURML*ml);
-      //digitalWrite(PINPOMPE3,LOW);
+      digitalWrite(PINPOMPE4,LOW);
+      delay(FACTEURML*ml);
+      digitalWrite(PINPOMPE4,HIGH);
       Serial.print("Distribue pompe4 : ");
       Serial.print("Distribue pompe4 : ");
       Serial.print(ml);
       Serial.print(ml);
       Serial.println("ml");
       Serial.println("ml");
@@ -241,6 +206,10 @@ void setup()
   pinMode(PINPOMPE2, OUTPUT);
   pinMode(PINPOMPE2, OUTPUT);
   pinMode(PINPOMPE3, OUTPUT);
   pinMode(PINPOMPE3, OUTPUT);
   pinMode(PINPOMPE4, OUTPUT);
   pinMode(PINPOMPE4, OUTPUT);
+  digitalWrite(PINPOMPE1,HIGH);
+  digitalWrite(PINPOMPE2,HIGH);
+  digitalWrite(PINPOMPE3,HIGH);
+  digitalWrite(PINPOMPE4,HIGH);
 
 
   //Blynk.begin(auth, ssid, pass);
   //Blynk.begin(auth, ssid, pass);
   // You can also specify server:
   // You can also specify server: