| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- /*************************************************************
- 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 ESP8266 chip.
- Note: This requires ESP8266 support package:
- https://github.com/esp8266/Arduino
- Please be sure to select the right ESP8266 module
- in the Tools -> Board menu!
- 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 <SPI.h>
- #include <ESP8266WiFi.h>
- #include <BlynkSimpleEsp8266.h>
- // You should get Auth Token in the Blynk App.
- // Go to the Project Settings (nut icon).
- char auth[] = "qDSPfbEHHMiQxMNFeKZ2_lKwbxD81Yu8";
- // Your WiFi credentials.
- // Set password to "" for open networks.
- char ssid[] = "Livebox-7C2C";
- char pass[] = "566C61F61F9C925C9F3D7D79E6";
- #define MASK_TB 0x80
- #define MASK_TH 0x40
- #define MASK_CH 0x20
- #define MASK_RB 0x10
- #define MASK_A1 0x08
- #define MASK_A2 0x04
- #define MASK_OS 0x01
- BlynkTimer timer;
- WidgetLED led1(V11) // Led Tech bas
- , led2(V12) // Led Tech Haut
- , led3(V13) // Led Cuve Haut
- , led4(V14) // Led Reserve Bas
- , led5(V15) // Led Autre1
- , led6(V16); // Led Autre2
- void setup(){
- // Debug console
- Serial.begin(9600);
- Blynk.begin(auth, ssid, pass);
- timer.setInterval(1000L, statusOrdi); //Configuration du timer pour que toute les seconde ils appelles la fonction de status.
- }
- void loop(){
- Blynk.run();
- timer.run();
- }
- void statusOrdi(){
- uint8_t tab[7];
- //SPI_Status(tab); //Lecture du status de l'ordinateur
- //Transmission des donnée et notification si probleme
- Blynk.virtualWrite(8, tab[1]); //On transmet a blynk sur la broche v8 la valeur de la température de l'air
- if (tab[1]<18)
- Blynk.notify("Temérature air trop froid");
- else (tab[1]>29)
- Blynk.notify("Temérature air trop Chaud");
-
- Blynk.virtualWrite(9, tab[2]);
- if (tab[1]<23)
- Blynk.notify("Temérature Eau trop froid");
- else (tab[1]>29)
- Blynk.notify("Temérature Eau trop Chaud");
-
- Blynk.virtualWrite(10, tab[3]);
- if (tab[1]<7.5)
- Blynk.notify("PH trop bas");
- else (tab[1]>8.5)
- Blynk.notify("PH trop Haut");
-
-
- if((tab[4] & MASK_TB) = MASK_TB)
- led1.on();
- else
- led1.off();
- if((tab[4] & MASK_TH) = MASK_TH)
- led2.on();
- Blynk.notify("Cuve technique haut");
- else
- led2.off();
- if((tab[4] & MASK_CH) = MASK_CH)
- led3.on();
- else
- led3.off();
- if((tab[4] & MASK_RB) = MASK_RB)
- led4.on();
- Blynk.notify("Reserve bas");
- else
- led4.off();
- if((tab[4] & MASK_A1) = MASK_A1)
- led5.on();
- else
- led5.off();
- if((tab[4] & MASK_A2) = MASK_A2)
- led6.on();
- else
- led6.off();
- // reste a transmetre la dernoiere osmolation
- }
- BLYNK_WRITE(V0){ //Bouton Ecumeur
- uint8_t data;
- Read_actionneur(data);
- if (param.asInt())
- data = data | MASK_ECU;
- else {
- data = data & (!MASK_ECU);
- Write_actionneur(data);
- }
- BLYNK_WRITE(V1){ //Bouton Remonter
- uint8_t data;
- Read_actionneur(data);
- if (param.asInt())
- data = data | MASK_ECU;
- else {
- data = data & (!MASK_ECU);
- Write_actionneur(data);
- }
- BLYNK_WRITE(V2){ //Bouton Chauffage
- uint8_t data;
- Read_actionneur(data);
- if (param.asInt())
- data = data | MASK_ECU;
- else {
- data = data & (!MASK_ECU);
- Write_actionneur(data);
- }
- BLYNK_WRITE(V3){ //Bouton Brassage1
- uint8_t data;
- Read_actionneur(data);
- if (param.asInt())
- data = data | MASK_ECU;
- else {
- data = data & (!MASK_ECU);
- Write_actionneur(data);
- }
- BLYNK_WRITE(V4){ //Bouton Brassage2
- uint8_t data;
- Read_actionneur(data);
- if (param.asInt())
- data = data | MASK_ECU;
- else {
- data = data & (!MASK_ECU);
- Write_actionneur(data);
- }
- BLYNK_WRITE(V20){ //Bouton Osmolateur
- }
- BLYNK_WRITE(V5){ //Ventilateur 1
-
- }
- BLYNK_WRITE(V6){ //Ventilateur 3
-
- }
- BLYNK_WRITE(V7){ //Ventilateur 3
-
- }
|