Smart coffee machine with facial recognition and remote control
Dependencies: Camera_LS_Y201 EthernetInterface EthernetNetIf HTTPClient SRF05 TextLCD mbed-rtos mbed-src
eau.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 "eau.h" |
projetmacintel | 0:43669f623d43 | 2 | |
projetmacintel | 0:43669f623d43 | 3 | DigitalOut relaisEau(p23); |
projetmacintel | 0:43669f623d43 | 4 | DigitalIn capteurEau(p11); |
projetmacintel | 0:43669f623d43 | 5 | |
projetmacintel | 0:43669f623d43 | 6 | void informerServeurEtatBacEau(int capteur_eau); |
projetmacintel | 0:43669f623d43 | 7 | |
projetmacintel | 0:43669f623d43 | 8 | void checkContenanceReserveEau(bool initialisation) |
projetmacintel | 0:43669f623d43 | 9 | { |
projetmacintel | 0:43669f623d43 | 10 | capteurEau.mode(PullUp); |
projetmacintel | 0:43669f623d43 | 11 | |
projetmacintel | 0:43669f623d43 | 12 | if(initialisation) |
projetmacintel | 0:43669f623d43 | 13 | informerServeurEtatBacEau(capteurEau); |
projetmacintel | 0:43669f623d43 | 14 | |
projetmacintel | 0:43669f623d43 | 15 | if(relaisEau != capteurEau.read() || initialisation) |
projetmacintel | 0:43669f623d43 | 16 | { |
projetmacintel | 0:43669f623d43 | 17 | // On informe le serveur de l'absence (ou non) d'eau |
projetmacintel | 0:43669f623d43 | 18 | if(!initialisation) |
projetmacintel | 0:43669f623d43 | 19 | informerServeurEtatBacEau(capteurEau); |
projetmacintel | 0:43669f623d43 | 20 | |
projetmacintel | 0:43669f623d43 | 21 | // On renvoie l'information à la machine |
projetmacintel | 0:43669f623d43 | 22 | if((int)capteurEau.read() == 1) |
projetmacintel | 0:43669f623d43 | 23 | relaisEau = 0; |
projetmacintel | 0:43669f623d43 | 24 | |
projetmacintel | 0:43669f623d43 | 25 | else |
projetmacintel | 0:43669f623d43 | 26 | relaisEau = 1; |
projetmacintel | 0:43669f623d43 | 27 | } |
projetmacintel | 0:43669f623d43 | 28 | } |
projetmacintel | 0:43669f623d43 | 29 | |
projetmacintel | 0:43669f623d43 | 30 | void informerServeurEtatBacEau(int capteur_eau) |
projetmacintel | 0:43669f623d43 | 31 | { |
projetmacintel | 0:43669f623d43 | 32 | if(capteur_eau == 0) |
projetmacintel | 0:43669f623d43 | 33 | envoyerRequete("gestion_eau.php?bac_vide"); |
projetmacintel | 0:43669f623d43 | 34 | |
projetmacintel | 0:43669f623d43 | 35 | else |
projetmacintel | 0:43669f623d43 | 36 | envoyerRequete("gestion_eau.php?bac_plein"); |
projetmacintel | 0:43669f623d43 | 37 | } |