easystepper

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: BSD-3-Clause Imports: 3 Imported by: 17

Documentation

Overview

Package easystepper provides a simple driver to rotate a 4-wire stepper motor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device holds the pins and the delay between steps

func New

func New(config DeviceConfig) (*Device, error)

New returns a new single easystepper driver given a DeviceConfig

func (*Device) Configure added in v0.9.0

func (d *Device) Configure()

Configure configures the pins of the Device

func (*Device) Move

func (d *Device) Move(steps int32)

Move rotates the motor the number of given steps (negative steps will rotate it the opposite direction)

func (*Device) Off added in v0.9.0

func (d *Device) Off()

Off turns off all motor pins

type DeviceConfig added in v0.21.0

type DeviceConfig struct {
	// Pin1 ... Pin4 determines the pins to configure and use for the device
	Pin1, Pin2, Pin3, Pin4 machine.Pin
	// StepCount is the number of steps required to perform a full revolution of the stepper motor
	StepCount uint
	// RPM determines the speed of the stepper motor in 'Revolutions per Minute'
	RPM uint
	// Mode determines the coil sequence used to perform a single step
	Mode StepMode
}

DeviceConfig contains the configuration data for a single easystepper driver

type DualDevice added in v0.9.0

type DualDevice struct {
	// contains filtered or unexported fields
}

DualDevice holds information for controlling 2 motors

func NewDual added in v0.9.0

func NewDual(config DualDeviceConfig) (*DualDevice, error)

NewDual returns a new dual easystepper driver given 8 pins, number of steps and rpm

func (*DualDevice) Configure added in v0.9.0

func (d *DualDevice) Configure()

Configure configures the pins of the DualDevice

func (*DualDevice) Move added in v0.9.0

func (d *DualDevice) Move(stepsA, stepsB int32)

Move rotates the motors the number of given steps (negative steps will rotate it the opposite direction)

func (*DualDevice) Off added in v0.9.0

func (d *DualDevice) Off()

Off turns off all motor pins

type DualDeviceConfig added in v0.21.0

type DualDeviceConfig struct {
	DeviceConfig
	// Pin5 ... Pin8 determines the pins to configure and use for the second device
	Pin5, Pin6, Pin7, Pin8 machine.Pin
}

DualDeviceConfig contains the configuration data for a dual easystepper driver

type StepMode added in v0.21.0

type StepMode uint8

StepMode determines the coil sequence used to perform a single step

const (
	// ModeFour uses a 'four step' coil sequence (12-23-34-41). This is the default (zero-value) mode
	ModeFour StepMode = iota
	// ModeEight uses an 'eight step' coil sequence (1-12-2-23-3-34-4-41)
	ModeEight
)

Valid values for StepMode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL