Smart coffee machine with facial recognition and remote control

Dependencies:   Camera_LS_Y201 EthernetInterface EthernetNetIf HTTPClient SRF05 TextLCD mbed-rtos mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers purge.cpp Source File

purge.cpp

00001 #include "purge.h"
00002 
00003 DigitalOut relaisPurge(p7);
00004 
00005 void purgerLaMachine()
00006 {
00007     /*bool message_affiche = false;
00008     
00009     while(!tasseEnPlace())
00010     {
00011         if(!message_affiche)
00012         {
00013             afficherAuCentreDeLEcran("Veuillez placer", "un recipient");
00014             message_affiche = true;
00015         }
00016     }*/
00017     
00018     afficherAuCentreDeLEcran("Purge de", "la machine...");
00019     
00020     wait(0.1);
00021     relaisPurge = 1;
00022     wait(0.5);
00023     relaisPurge = 0;
00024     wait(1);
00025     
00026     while(capteurChauffeClignotant(0.5, 0.05)); // On attend la fin de la purge
00027     afficherAuCentreDeLEcran("Machine purgee !", "");
00028     
00029     wait(3);
00030 }
00031 
00032 void checkPurge()
00033 {
00034     char reponse[20];
00035     
00036     // On cherche à savoir si une demande de purge (via Internet) a été effectuée
00037     if(envoyerRequete("gestion_purge.php", reponse, 20))
00038     {
00039         if(reponse[1] == '1')
00040         {
00041             printf("Check purge : demande\n\r");
00042             envoyerRequete("gestion_purge.php?purge_en_cours");
00043             
00044             if(machineEteinte())
00045                 allumerMachine();
00046             
00047             while(capteurChauffeClignotant()); // On attend les éventuelles préparations en cours
00048             
00049             purgerLaMachine();
00050             envoyerRequete("gestion_purge.php?fin_purge");
00051         }
00052     }
00053 }