#include "PortServo.hpp"
Public Member Functions | |
PortServo () | |
void | begin (int inPin) |
void | beginByAccessory (int inStartingPosition) |
bool | IsActive () const |
int | GetPin () const |
GPIO_pin_t | GetDIOPin () const |
void | MovePosition (unsigned long inDuration, int inEndPosition) |
int | GetPosition () |
![]() | |
Port () | |
virtual void | begin () |
PORT_STATE | GetState () const |
int | GetSpeed () const |
virtual int | SetSpeed (int inSpeed) |
bool | IsLeftDir () const |
bool | IsRightDir () const |
bool | IsStopped () const |
virtual void | MoveLeftDir (unsigned long inDuration = 0) |
virtual void | MoveRightDir (unsigned long inDuration = 0) |
void | MoveLeftDir (unsigned long inDuration, int inSpeed) |
void | MoveRightDir (unsigned long inDuration, int inSpeed) |
PORT_STATE | MoveToggle (unsigned long inDuration = 0) |
virtual void | MoveStop () |
Protected Attributes | |
int | pin |
Servo | servo |
![]() | |
PIN_TYPE | pinType |
PORT_STATE | state |
int | speed |
Additional Inherited Members | |
![]() | |
int | MapValue (int inValue, PIN_TYPE inType = UNDEFINED) const |
int | beginPin (int inPin, PIN_TYPE inType = UNDEFINED) const |
void | MovePin (int inPin, int inValue, PIN_TYPE inType = UNDEFINED) const |
As the name of the class try to tell, this class s dedicated for a servo port. It uses the library Servo installed with the Arduino IDE.
Definition at line 13 of file PortServo.hpp.
PortServo::PortServo | ( | ) |
Default constructor.
Definition at line 11 of file PortServo.cpp.
void PortServo::begin | ( | int | inPin | ) |
Initialize the instance.
inPin | Command pin for the servo. |
Definition at line 17 of file PortServo.cpp.
|
virtual |
Initialize the starting position of the servo.
inStartingPosition | New position. The servo will physically move if necessary ! |
Reimplemented from Port.
Definition at line 24 of file PortServo.cpp.
|
inline |
|
inline |
|
virtual |
Gets the current position of the port.
Reimplemented from Port.
Definition at line 60 of file PortServo.cpp.
|
inline |
Checks if this port is active. To be active, begin() must have been called.
Definition at line 37 of file PortServo.hpp.
|
virtual |
Move the servo to the given position using a given duration.
inDuration | the movement should take the time of this delay. |
inEndPosition | final position to reach. |
Reimplemented from Port.
Definition at line 42 of file PortServo.cpp.
|
protected |
Command pin connected to the servo.
Definition at line 17 of file PortServo.hpp.
|
protected |
Instance of the class Servo.
Definition at line 19 of file PortServo.hpp.