Documentation
¶
Index ¶
Constants ¶
View Source
const ( Speed20 = 20 Speed40 = 40 Speed60 = 60 Speed80 = 80 Speed100 = 100 )
View Source
const StepAngle float64 = 0.0883268076179
StepAngle = (Step angle / gear reduction ratio) = (5.625 / 63.68395)
Variables ¶
View Source
var (
Sequence28BYJ48 = [8][4]uint8{
{1, 0, 0, 0},
{1, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 1, 1},
{0, 0, 0, 1},
{1, 0, 0, 1},
}
)
Functions ¶
Types ¶
type Direction ¶
type Direction int8
Direction is used to give stepper motor direction (clockwise or counterclockwise)
type Speed ¶
type Speed uint8
Speed is the stepper motor speed, it ensures to use only allowed speed values
type StepperMotor ¶
type StepperMotor struct {
*Options
}
func NewStepperMotor ¶
func NewStepperMotor(opts ...OptFunc) *StepperMotor
NewStepperMotor StepperMotor constructor
func (*StepperMotor) GetCurrentPosition ¶
func (s *StepperMotor) GetCurrentPosition() int
GetCurrentPosition returns s.currentPos value
func (*StepperMotor) GetNumOfSteps ¶
func (s *StepperMotor) GetNumOfSteps() uint
GetNumOfSteps returns s.nSteps value
func (*StepperMotor) GetThreshold ¶
func (s *StepperMotor) GetThreshold() uint
GetThreshold returns s.threshold value
func (*StepperMotor) IsRunning ¶
func (s *StepperMotor) IsRunning() bool
IsRunning returns s.running value
func (*StepperMotor) Run ¶
func (s *StepperMotor) Run(direction Direction, angle uint, speed Speed)
Run the stepper motor using given params (direction, angle and speed)
func (*StepperMotor) SetThreshold ¶
func (s *StepperMotor) SetThreshold(threshold uint)
SetThreshold returns s.threshold value
Click to show internal directories.
Click to hide internal directories.