![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
carte esclave pompe 2020 V1
Dependencies: mbed ident_crac
Diff: class_ventouse.cpp
- Revision:
- 7:43d9c70b6689
- Parent:
- 6:fda992188a2f
- Child:
- 8:a25a9c22ba91
diff -r fda992188a2f -r 43d9c70b6689 class_ventouse.cpp --- a/class_ventouse.cpp Mon May 20 09:40:21 2019 +0000 +++ b/class_ventouse.cpp Tue May 21 14:17:12 2019 +0000 @@ -2,7 +2,7 @@ #include "extern.h" #include "ident_CRAC.h" -float seuil[8] = {0.10, 0.5, 0.5, 0.5, 0.10, 0.5, 0.5, 0.5}; +float seuil[8] = {0.10, 0.3, 0.3, 0.3, 0.10, 0.3, 0.3, 0.3}; Ventouse::Ventouse(PinName pinPompe, PinName pinCapteurPression, char index) : m_pinPompe(pinPompe), @@ -59,7 +59,7 @@ case Attraper : wait_ms(10.0); - if(getPression()) + if(getPression()==1) { can.write(CANMessage(HACHEUR_GET_ATOM_ACK,&m_index,1)); etat = Attraper_ok; @@ -79,7 +79,8 @@ break; case Relacher : - if(!getPression()) + wait_ms(10.0); + if(getPression() == 0) { can.write(CANMessage(HACHEUR_RELEASE_ATOM_ACK,&m_index,1)); if(flag_electrovanne) m_electrovanne->write(0.0); @@ -99,7 +100,7 @@ void Ventouse::attraper() { - m_pompe->write(0.85); + m_pompe->write(0.7); if(flag_electrovanne) m_electrovanne->write(0.0); } @@ -108,12 +109,13 @@ { m_pompe->write(0.0); if(flag_electrovanne) m_electrovanne->write(1.0); + wait_ms(300.0); } bool Ventouse::getPression() { - //printf("capteur %d : %f\n", m_index, m_pression->read()); + printf("capteur %d : %f\n", m_index, m_pression->read()); if(m_pression->read() > seuil[m_index]){ return 1; }