Accessories
Arduino for motors and lights library.
PortServo.hpp
1 //-------------------------------------------------------------------
2 #ifndef __PortServo_H__
3 #define __PortServo_H__
4 //-------------------------------------------------------------------
5 
6 #ifndef NO_SERVO
7 #include "Servo.h"
8 #include "Accessories.h"
9 
13 class PortServo : public Port
14 {
15  protected:
17  int pin;
19  Servo servo;
20 
21  public:
23  PortServo();
24 
28  void begin(int inPin);
32  void beginByAccessory(int inStartingPosition);
33 
37  inline bool IsActive() const { return this->pin > -1; }
41  inline int GetPin() const { return this->pin; }
45  inline GPIO_pin_t GetDIOPin() const { return Arduino_to_GPIO_pin(this->pin); }
46 
51  void MovePosition(unsigned long inDuration, int inEndPosition);
55  int GetPosition();
56 #ifdef ACCESSORIES_PRINT_ACCESSORIES
57 
60  void printPort();
61 #endif
62 };
63 #endif
64 
65 //-------------------------------------------------------------------
66 #endif
67 //-------------------------------------------------------------------
int GetPosition()
Definition: PortServo.cpp:60
void MovePosition(unsigned long inDuration, int inEndPosition)
Definition: PortServo.cpp:42
GPIO_pin_t GetDIOPin() const
Definition: PortServo.hpp:45
int GetPin() const
Definition: PortServo.hpp:41
void beginByAccessory(int inStartingPosition)
Definition: PortServo.cpp:24
virtual void begin()
Definition: Port.hpp:99
Servo servo
Definition: PortServo.hpp:19
Definition: Port.hpp:61
bool IsActive() const
Definition: PortServo.hpp:37