nerf-turret 1
Infrared targeting nerf turret
Loading...
Searching...
No Matches
servo_driver.ServoDriver Class Reference

This class implements a servo driver for a position-controlled servo. More...

Public Member Functions

def __init__ (self, str pwm_pin, int timer, int ch)
 Creates a servo driver and configures the appropriate pins, timers, and timer channels.
 
def return_to_zero (self)
 Returns the servo to the zero position.
 
def set_position (self, int position)
 Sets the servo position based on the PWM level.
 

Public Attributes

 pwm_pin
 Pin object for PWM pin.
 
 timer
 Timer object for the servo driver.
 
 pwm
 Channel object for PWM channel.
 

Detailed Description

This class implements a servo driver for a position-controlled servo.

Constructor & Destructor Documentation

◆ __init__()

def servo_driver.ServoDriver.__init__ (   self,
str  pwm_pin,
int  timer,
int  ch 
)

Creates a servo driver and configures the appropriate pins, timers, and timer channels.

Parameters
pwm_pinString containing the pin label of the PWM pin (e.g. 'A10' for pin A10)
timerNumber of the timer to configure, given as integer (e.g. 5 for TIM5)
chThe channel number of the PWM pin, given as integer

Member Function Documentation

◆ set_position()

def servo_driver.ServoDriver.set_position (   self,
int  position 
)

Sets the servo position based on the PWM level.

Parameters
positionDegree angle to move the servo. Given as integer from -90 to 90 (inclusive). Overall range may vary depending on servo model.

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