Smart coffee machine with facial recognition and remote control
Dependencies: Camera_LS_Y201 EthernetInterface EthernetNetIf HTTPClient SRF05 TextLCD mbed-rtos mbed-src
cafe.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 "cafe.h" |
projetmacintel | 0:43669f623d43 | 2 | |
projetmacintel | 0:43669f623d43 | 3 | DigitalOut relaisCafe(p6); // 22 |
projetmacintel | 0:43669f623d43 | 4 | |
projetmacintel | 0:43669f623d43 | 5 | void faireUnCafe() |
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", "votre tasse"); |
projetmacintel | 0:43669f623d43 | 14 | message_affiche = true; |
projetmacintel | 0:43669f623d43 | 15 | } |
projetmacintel | 0:43669f623d43 | 16 | } |
projetmacintel | 0:43669f623d43 | 17 | |
projetmacintel | 0:43669f623d43 | 18 | afficherAuCentreDeLEcran("Boisson en cours", "de preparation"); |
projetmacintel | 0:43669f623d43 | 19 | |
projetmacintel | 0:43669f623d43 | 20 | wait(0.1); |
projetmacintel | 0:43669f623d43 | 21 | relaisCafe = 1; |
projetmacintel | 0:43669f623d43 | 22 | wait(0.5); |
projetmacintel | 0:43669f623d43 | 23 | relaisCafe = 0; |
projetmacintel | 0:43669f623d43 | 24 | wait(0.5); |
projetmacintel | 0:43669f623d43 | 25 | wait(17); |
projetmacintel | 0:43669f623d43 | 26 | attendreFinDePreparation(); |
projetmacintel | 0:43669f623d43 | 27 | afficherAuCentreDeLEcran("Votre cafe", "est pret"); |
projetmacintel | 0:43669f623d43 | 28 | } |
projetmacintel | 0:43669f623d43 | 29 | |
projetmacintel | 0:43669f623d43 | 30 | void checkCafe() |
projetmacintel | 0:43669f623d43 | 31 | { |
projetmacintel | 0:43669f623d43 | 32 | char reponse[20]; |
projetmacintel | 0:43669f623d43 | 33 | |
projetmacintel | 0:43669f623d43 | 34 | // On cherche à savoir si une demande de café (via Internet) a été effectuée |
projetmacintel | 0:43669f623d43 | 35 | if(envoyerRequete("gestion_cafe.php", reponse, 20)) |
projetmacintel | 0:43669f623d43 | 36 | { |
projetmacintel | 0:43669f623d43 | 37 | if(reponse[1] == '1') |
projetmacintel | 0:43669f623d43 | 38 | { |
projetmacintel | 0:43669f623d43 | 39 | printf("Check café : demande\n\r"); |
projetmacintel | 0:43669f623d43 | 40 | envoyerRequete("gestion_cafe.php?boisson_en_preparation"); |
projetmacintel | 0:43669f623d43 | 41 | |
projetmacintel | 0:43669f623d43 | 42 | if(machineEteinte()) |
projetmacintel | 0:43669f623d43 | 43 | allumerMachine(); |
projetmacintel | 0:43669f623d43 | 44 | |
projetmacintel | 0:43669f623d43 | 45 | while(machineOccupee()); // On attend les éventuelles préparations en cours |
projetmacintel | 0:43669f623d43 | 46 | |
projetmacintel | 0:43669f623d43 | 47 | setPreferenceLongueur(reponse[3] - '0' + 1); |
projetmacintel | 0:43669f623d43 | 48 | setPreferenceIntensite(reponse[5] - '0' + 1); |
projetmacintel | 0:43669f623d43 | 49 | faireUnCafe(); |
projetmacintel | 0:43669f623d43 | 50 | |
projetmacintel | 0:43669f623d43 | 51 | envoyerRequete("gestion_cafe.php?boisson_prete"); |
projetmacintel | 0:43669f623d43 | 52 | } |
projetmacintel | 0:43669f623d43 | 53 | } |
projetmacintel | 0:43669f623d43 | 54 | } |
projetmacintel | 0:43669f623d43 | 55 |