Smart coffee machine with facial recognition and remote control
Dependencies: Camera_LS_Y201 EthernetInterface EthernetNetIf HTTPClient SRF05 TextLCD mbed-rtos mbed-src
purge.cpp@0:43669f623d43, 2014-01-15 (annotated)
- Committer:
- projetmacintel
- Date:
- Wed Jan 15 11:09:52 2014 +0000
- Revision:
- 0:43669f623d43
dep?t final PAO Macintel
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
projetmacintel | 0:43669f623d43 | 1 | #include "purge.h" |
projetmacintel | 0:43669f623d43 | 2 | |
projetmacintel | 0:43669f623d43 | 3 | DigitalOut relaisPurge(p7); |
projetmacintel | 0:43669f623d43 | 4 | |
projetmacintel | 0:43669f623d43 | 5 | void purgerLaMachine() |
projetmacintel | 0:43669f623d43 | 6 | { |
projetmacintel | 0:43669f623d43 | 7 | /*bool message_affiche = false; |
projetmacintel | 0:43669f623d43 | 8 | |
projetmacintel | 0:43669f623d43 | 9 | while(!tasseEnPlace()) |
projetmacintel | 0:43669f623d43 | 10 | { |
projetmacintel | 0:43669f623d43 | 11 | if(!message_affiche) |
projetmacintel | 0:43669f623d43 | 12 | { |
projetmacintel | 0:43669f623d43 | 13 | afficherAuCentreDeLEcran("Veuillez placer", "un recipient"); |
projetmacintel | 0:43669f623d43 | 14 | message_affiche = true; |
projetmacintel | 0:43669f623d43 | 15 | } |
projetmacintel | 0:43669f623d43 | 16 | }*/ |
projetmacintel | 0:43669f623d43 | 17 | |
projetmacintel | 0:43669f623d43 | 18 | afficherAuCentreDeLEcran("Purge de", "la machine..."); |
projetmacintel | 0:43669f623d43 | 19 | |
projetmacintel | 0:43669f623d43 | 20 | wait(0.1); |
projetmacintel | 0:43669f623d43 | 21 | relaisPurge = 1; |
projetmacintel | 0:43669f623d43 | 22 | wait(0.5); |
projetmacintel | 0:43669f623d43 | 23 | relaisPurge = 0; |
projetmacintel | 0:43669f623d43 | 24 | wait(1); |
projetmacintel | 0:43669f623d43 | 25 | |
projetmacintel | 0:43669f623d43 | 26 | while(capteurChauffeClignotant(0.5, 0.05)); // On attend la fin de la purge |
projetmacintel | 0:43669f623d43 | 27 | afficherAuCentreDeLEcran("Machine purgee !", ""); |
projetmacintel | 0:43669f623d43 | 28 | |
projetmacintel | 0:43669f623d43 | 29 | wait(3); |
projetmacintel | 0:43669f623d43 | 30 | } |
projetmacintel | 0:43669f623d43 | 31 | |
projetmacintel | 0:43669f623d43 | 32 | void checkPurge() |
projetmacintel | 0:43669f623d43 | 33 | { |
projetmacintel | 0:43669f623d43 | 34 | char reponse[20]; |
projetmacintel | 0:43669f623d43 | 35 | |
projetmacintel | 0:43669f623d43 | 36 | // On cherche à savoir si une demande de purge (via Internet) a été effectuée |
projetmacintel | 0:43669f623d43 | 37 | if(envoyerRequete("gestion_purge.php", reponse, 20)) |
projetmacintel | 0:43669f623d43 | 38 | { |
projetmacintel | 0:43669f623d43 | 39 | if(reponse[1] == '1') |
projetmacintel | 0:43669f623d43 | 40 | { |
projetmacintel | 0:43669f623d43 | 41 | printf("Check purge : demande\n\r"); |
projetmacintel | 0:43669f623d43 | 42 | envoyerRequete("gestion_purge.php?purge_en_cours"); |
projetmacintel | 0:43669f623d43 | 43 | |
projetmacintel | 0:43669f623d43 | 44 | if(machineEteinte()) |
projetmacintel | 0:43669f623d43 | 45 | allumerMachine(); |
projetmacintel | 0:43669f623d43 | 46 | |
projetmacintel | 0:43669f623d43 | 47 | while(capteurChauffeClignotant()); // On attend les éventuelles préparations en cours |
projetmacintel | 0:43669f623d43 | 48 | |
projetmacintel | 0:43669f623d43 | 49 | purgerLaMachine(); |
projetmacintel | 0:43669f623d43 | 50 | envoyerRequete("gestion_purge.php?fin_purge"); |
projetmacintel | 0:43669f623d43 | 51 | } |
projetmacintel | 0:43669f623d43 | 52 | } |
projetmacintel | 0:43669f623d43 | 53 | } |