![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
carte esclave pompe 2020 V1
Dependencies: mbed ident_crac
Diff: class_ventouse.cpp
- Revision:
- 19:952208276c63
- Parent:
- 16:5e00af31ae8a
- Child:
- 20:677dcf689523
--- a/class_ventouse.cpp Sat May 25 14:08:48 2019 +0000 +++ b/class_ventouse.cpp Thu Mar 05 16:32:21 2020 +0000 @@ -1,16 +1,9 @@ #include "class_ventouse.h" -#ifdef ROBOT_SMALL //float seuil[NB_VENTOUSES] = {0.10, 0.3, 0.3, 0.3, 0.10, 0.3, 0.3, 0.3}; float seuil[NB_VENTOUSES] = {0.1, 0.1, 0.1, 0.1, 0.10, 0.1, 0.1, 0.1}; #define PWM_POMPE 0.7 -#endif - -#ifdef ROBOT_BIG -float seuil[NB_VENTOUSES] = {0.2, 0.1, 0.2}; -#define PWM_POMPE 0.9 -#endif - +#define PWM_ELECTROVANNE 0.35 Ventouse::Ventouse(PinName pinPompe, PinName pinCapteurPression, char index) : m_pinPompe(pinPompe), m_pinCapteurPression(pinCapteurPression), m_index(index) @@ -18,7 +11,7 @@ m_pompe = new PwmOut(m_pinPompe); m_pression = new AnalogIn(m_pinCapteurPression); - m_pompe->period_us(50); + m_pompe->period_us(20); m_pompe->write(0); @@ -35,11 +28,11 @@ m_pinElectrovanne(pinElectrovanne), m_pinCapteurPression(pinCapteurPression), m_index(index) { m_pompe = new PwmOut(m_pinPompe); - m_electrovanne = new DigitalOut(m_pinElectrovanne); + m_electrovanne = new PwmOut(m_pinElectrovanne); m_pression = new AnalogIn(m_pinCapteurPression); - m_pompe->period_us(50); - //m_electrovanne->period_us(50); + m_pompe->period_us(20); + m_electrovanne->period_us(20); m_pompe->write(0); m_electrovanne->write(0); @@ -108,16 +101,13 @@ void Ventouse::attraper() { m_pompe->write(PWM_POMPE); - if(flag_electrovanne) m_electrovanne->write(0); - + if(flag_electrovanne) m_electrovanne->write(0.0); } void Ventouse::relacher() { m_pompe->write(0.0); - if(flag_electrovanne) m_electrovanne->write(1); - wait_ms(100.0); - + if(flag_electrovanne) m_electrovanne->write(PWM_ELECTROVANNE); } bool Ventouse::getPression()