uStepper
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
uStepperServo Class Reference

Prototype of class for ustepper servo. More...

#include <uStepperServo.h>

Public Member Functions

 uStepperServo ()
 Constructor for servo class. More...
 
uint8_t attach (int pinArg)
 Attaches the servo motor to a specific pin. More...
 
void detach ()
 Detaches the servo motor from the uStepper. More...
 
void write (int angleArg)
 Specify angle of servo motor. More...
 
void setMinimumPulse (uint16_t t)
 Sets the minimum pulse. More...
 
void setMaximumPulse (uint16_t t)
 Sets the maximum pulse. More...
 

Static Public Member Functions

static void refresh ()
 Updates servo output pins. More...
 

Private Attributes

uint8_t pin
 
uint8_t angle
 
uint16_t pulse
 
uint8_t min16
 
uint8_t max16
 
class uStepperServonext
 

Static Private Attributes

static uStepperServofirst
 

Detailed Description

Prototype of class for ustepper servo.

Definition at line 44 of file uStepperServo.h.

Constructor & Destructor Documentation

◆ uStepperServo()

uStepperServo::uStepperServo ( )

Constructor for servo class.

This constructor is used to instantiate a new servo class, and should be used for each servo the user wishes to connect to the uStepper.

Definition at line 103 of file uStepperServo.cpp.

Member Function Documentation

◆ attach()

uint8_t uStepperServo::attach ( int  pinArg)

Attaches the servo motor to a specific pin.

This method is used to attach the instantiated servo motor object to a specific pin connected to the servo input terminal

Parameters
[in]pinArgPin connected to servo input terminal
Returns
0 on failure

Definition at line 118 of file uStepperServo.cpp.

◆ detach()

void uStepperServo::detach ( )

Detaches the servo motor from the uStepper.

This method detaches the servo motor from the uStepper

Definition at line 130 of file uStepperServo.cpp.

◆ refresh()

void uStepperServo::refresh ( )
static

Updates servo output pins.

This method updates the pulses on the servo output pins. This method must be called at least once every 50 ms, to ensure correct movement of the Servo motors!

Definition at line 152 of file uStepperServo.cpp.

◆ setMaximumPulse()

void uStepperServo::setMaximumPulse ( uint16_t  t)

Sets the maximum pulse.

This method sets the maximum pulse length given to the servo motor. This pulse length defines the fully open angle.

Parameters
[in]tMaximum pulse width in microseconds

Definition at line 113 of file uStepperServo.cpp.

◆ setMinimumPulse()

void uStepperServo::setMinimumPulse ( uint16_t  t)

Sets the minimum pulse.

This method sets the minimum pulse length given to the servo motor. This pulse length defines the fully closed angle.

Parameters
[in]tMinimum pulse width in microseconds

Definition at line 108 of file uStepperServo.cpp.

◆ write()

void uStepperServo::write ( int  angleArg)

Specify angle of servo motor.

This method sets an angle setpoint for the servo motor

Parameters
[in]angleArgThe angle argument

Definition at line 141 of file uStepperServo.cpp.

Member Data Documentation

◆ angle

uint8_t uStepperServo::angle
private

Current angle in degrees

Definition at line 50 of file uStepperServo.h.

◆ first

uStepperServo * uStepperServo::first
staticprivate

Pointer to hold address of first servo in chain

Definition at line 63 of file uStepperServo.h.

◆ max16

uint8_t uStepperServo::max16
private

Maximum pulse width in timer0 ticks (default = 150 = 2.4ms)

Definition at line 56 of file uStepperServo.h.

◆ min16

uint8_t uStepperServo::min16
private

Minimum pulse width in timer0 ticks (default = 92 = 1.472ms)

Definition at line 54 of file uStepperServo.h.

◆ next

class uStepperServo* uStepperServo::next
private

Pointer to hold address of next servo in chain, if multiple servos are connected

Definition at line 60 of file uStepperServo.h.

◆ pin

uint8_t uStepperServo::pin
private

Digital output pin connected to servo input terminal

Definition at line 48 of file uStepperServo.h.

◆ pulse

uint16_t uStepperServo::pulse
private

Pulse width in timer0 ticks (1 tick = 16us)

Definition at line 52 of file uStepperServo.h.


The documentation for this class was generated from the following files: