PINOUT à jour, trame CAN OK

Dependencies:   mbed ident_crac

Code carte pompe

class_ventouse.h

Committer:
kyxstark
Date:
2019-05-22
Revision:
8:a25a9c22ba91
Parent:
5:176e7353ba1c
Child:
12:2491a5b0f90b

File content as of revision 8:a25a9c22ba91:

#ifndef CLASS_VENTOUSE_H
#define CLASS_VENTOUSE_H

#include "mbed.h"
#include "ident_crac.h"


#ifdef ROBOT_SMALL
         #define NB_VENTOUSES 8
#endif

#ifdef ROBOT_BIG
         #define NB_VENTOUSES 3
#endif

typedef enum {Attente, Attraper, Attraper_ok, Relacher, Relacher_ok} type_etat ;

class Ventouse
{
public:
    Ventouse(PinName pinPompe, PinName pinCapteurPression, char index);
    Ventouse(PinName pinPompe, PinName pinElectrovanne, PinName pinCapteurPression, char index);
    
    void automate();
    void action(bool action);
    void attraper();
    void relacher();
    
    bool getPression();
    bool getPompe();
    
    
    void setPompe(float val);
    void setElectrovanne(int val);
    



private:
    PwmOut* m_pompe;
    //PwmOut* m_electrovanne;
    DigitalOut* m_electrovanne;
    AnalogIn* m_pression;
    
    bool flag_electrovanne;
    bool flag_attraper;
    bool flag_relacher;
    type_etat etat;
    char m_index;
    char m_ack;
    
    PinName m_pinPompe, m_pinElectrovanne, m_pinCapteurPression;

    
};

#endif //CLASS_VENTOUSE_H