//--------------------------------------------
class PowerSTEP01{
  public:
    PowerSTEP01();
    void begin();
    void stop();
    void moveV(int32_t aSpeed);
    void moveA(int32_t aPositionA);
    void moveAV(int32_t aPositionA, int32_t aSpeed);
    bool getPower();
    void setPower(bool aOn);
  private:
    uint8_t _power = 0; // 0=POWER_OFF, 1=POWER_ON
};

//--------------------------------------------
class Festo{
  public:
    Festo(uint8_t aPin_SETIN, uint8_t aPin_SETOUT, uint8_t aPin_GETIN, uint8_t aPin_GETOUT, uint8_t aPin_INDEX);
    void begin();
    void loop();
    //
    uint8_t getMode();
    bool getPower();
    void setPower(bool aOn);
    bool getInit();
    void setInit();
  private:
    struct{
      bool init = false;
      bool power = false;
      uint8_t mode = 0; // 0=HOLD, 1=MOVE_IN, 2=MOVE_OUT, 3=DISABLED
    } _status;

    struct{
      uint8_t SETIN;
      uint8_t SETOUT;
      uint8_t GETIN;
      uint8_t GETOUT;
      uint8_t INDEX;
    } _pin;
    
    void _readIN();
    void _setOUT();
};

//--------------------------------------------
PowerSTEP01 ps = PowerSTEP01();
Festo festo = Festo(8, 9, 10, 11, 7);