Bladeren bron

Arduino project

Remy 5 jaren geleden
bovenliggende
commit
d4065a8c2f
5 gewijzigde bestanden met toevoegingen van 254 en 1 verwijderingen
  1. BIN
      3D/pompe.stl
  2. BIN
      3D/pompeDoseuse.FCStd
  3. 0 1
      Document/.~lock.AideSoft.xlsx#
  4. BIN
      Document/AideSoft.xlsx
  5. 254 0
      Soft/MCUnode/Peristatique/Peristatique.ino

BIN
3D/pompe.stl


BIN
3D/pompeDoseuse.FCStd


+ 0 - 1
Document/.~lock.AideSoft.xlsx#

@@ -1 +0,0 @@
-,remy,lemien.home,05.11.2020 15:20,file:///home/remy/.config/libreoffice/4;

BIN
Document/AideSoft.xlsx


+ 254 - 0
Soft/MCUnode/Peristatique/Peristatique.ino

@@ -0,0 +1,254 @@
+/*************************************************************
+  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 */
+#define BLYNK_PRINT Serial
+
+
+#include <ESP8266WiFi.h>
+#include <BlynkSimpleEsp8266.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "5I28lN8RWcLQLvaoRyv0RNuiuBVwy99K";
+
+// Your WiFi credentials.
+// Set password to "" for open networks.
+char ssid[] = "Livebox-7C2C";
+char pass[] = "566C61F61F9C925C9F3D7D79E6";
+
+
+//************************************************************************
+//                Variable Global perso
+//************************************************************************
+#define POMPE1 0
+#define POMPE2 1
+#define POMPE3 2
+#define POMPE4 3
+
+const int PINPOMPE1 = 2;
+const int PINPOMPE2 = 3;
+const int PINPOMPE3 = 4;
+const int PINPOMPE4 = 5;
+
+float ML1 = 0.1;
+float ML2 = 0;
+float ML3 = 0;
+float ML4 = 0;
+
+bool AUTO1 = false;
+bool AUTO2 = false;
+bool AUTO3 = false;
+bool AUTO4 = false;
+
+
+
+
+//************************************************************************
+//                Fonction
+//************************************************************************
+int tempsDistrib(float ml) {
+  return ml * 10;
+}
+
+void Active(int pompe, float ml) {
+  char message[30];
+  switch (pompe) {
+    case (POMPE1):
+      //digitalWrite(PINPOMPE1,HIGH);
+      //delay(FACTEURML*ml);
+      //digitalWrite(PINPOMPE1,LOW);
+      Serial.print("Distribue pompe1 : ");
+      Serial.print(ml);
+      Serial.println("ml");
+      sprintf(message,"Distribution %.1fml de calcium", ml);
+      Blynk.notify(message);
+      break;
+    case (POMPE2):
+      //digitalWrite(PINPOMPE2,HIGH);
+      //delay(FACTEURML*ml);
+      //digitalWrite(PINPOMPE2,LOW);
+      Serial.print("Distribue pompe2 : ");
+      Serial.print(ml);
+      Serial.println("ml");
+      sprintf(message,"Distribution %.1fml de KH", ml);
+      Blynk.notify(message);
+      break;
+    case (POMPE3):
+      //digitalWrite(PINPOMPE3,HIGH);
+      //delay(FACTEURML*ml);
+      //digitalWrite(PINPOMPE3,LOW);
+      Serial.print("Distribue pompe3 : ");
+      Serial.print(ml);
+      Serial.println("ml");
+      sprintf(message,"Distribution %.1fml de Iode", ml);
+      Blynk.notify(message);
+      break;
+    case (POMPE4):
+      //digitalWrite(PINPOMPE3,HIGH);
+      //delay(FACTEURML*ml);
+      //digitalWrite(PINPOMPE3,LOW);
+      Serial.print("Distribue pompe4 : ");
+      Serial.print(ml);
+      Serial.println("ml");
+      sprintf(message,"Distribution %.1fml de Pompe4", ml);
+      Blynk.notify(message);
+      break;
+    default:
+      Serial.println("erreur");
+      break;
+  }
+}
+
+
+//************************************************************************
+//                Fonction Blynk
+//************************************************************************
+
+BLYNK_CONNECTED() {
+  Blynk.syncAll();
+}
+
+//Quantité
+BLYNK_WRITE(V0) {
+  ML1 = param.asFloat();
+}
+BLYNK_WRITE(V1) {
+  ML2 = param.asFloat();
+}
+BLYNK_WRITE(V2) {
+  ML3 = param.asFloat();
+}
+BLYNK_WRITE(V3) {
+  ML4 = param.asFloat();
+}
+
+//ON/OFF Auto
+BLYNK_WRITE(V4) {
+  if ( param.asInt()){
+    AUTO1 = true;
+  }
+  else
+    AUTO1 = false;
+
+}
+BLYNK_WRITE(V5) {
+  if ( param.asInt())
+    AUTO2 = true;
+  else
+    AUTO2 = false;
+
+}
+BLYNK_WRITE(V6) {
+  if ( param.asInt())
+    AUTO3 = true;
+  else
+    AUTO3 = false;
+}
+BLYNK_WRITE(V7) {
+  if ( param.asInt())
+    AUTO4 = true;
+  else
+    AUTO4 = false;
+
+}
+
+//Heure Distribution
+BLYNK_WRITE(V8) {
+    if ( param.asInt() && AUTO1 == true)
+    Active(POMPE1, ML1);
+}
+
+BLYNK_WRITE(V9) {
+  if ( param.asInt() && AUTO2  == true)
+    Active(POMPE2, ML2);
+}
+
+BLYNK_WRITE(V10) {
+  if ( param.asInt() && AUTO3 == true)
+    Active(POMPE3, ML3);
+}
+
+BLYNK_WRITE(V11) {
+  if ( param.asInt() && AUTO4 == true)
+    Active(POMPE4, ML4);
+}
+
+
+BLYNK_WRITE(V12) {
+  if ( param.asInt())
+    Active(POMPE1, ML1);
+}
+
+BLYNK_WRITE(V13) {
+  if ( param.asInt())
+    Active(POMPE2, ML2);
+}
+
+BLYNK_WRITE(V14) {
+  if ( param.asInt())
+    Active(POMPE3, ML3);
+}
+
+BLYNK_WRITE(V15) {
+  if ( param.asInt())
+    Active(POMPE4, ML4);
+}
+
+
+
+
+void setup()
+{
+  // Debug console
+  Serial.begin(9600);
+
+  //Pin Setup
+  pinMode(PINPOMPE1, OUTPUT);
+  pinMode(PINPOMPE2, OUTPUT);
+  pinMode(PINPOMPE3, OUTPUT);
+  pinMode(PINPOMPE4, OUTPUT);
+
+  //Blynk.begin(auth, ssid, pass);
+  // You can also specify server:
+  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
+  Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 1, 18), 8081);
+}
+
+void loop()
+{
+  Blynk.run();
+}