driver

package
v0.0.0-...-1be9672 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Motor

type Motor struct {
	Offset bool

	Speed int
	// contains filtered or unexported fields
}

Motor is a DC motor type.

func NewMotor

func NewMotor(channel, directionChannel int) *Motor

NewMotor creates a new DC motor instance.

func (*Motor) Backward

func (d *Motor) Backward()

Backward sets the motor direction backward.

func (*Motor) Close

func (d *Motor) Close() error

Close cleans up any used resources.

func (*Motor) Forward

func (d *Motor) Forward()

Forward sets the motor direction to forward.

func (*Motor) Init

func (d *Motor) Init() error

Init the TB6612 DC motor driver controller.

func (*Motor) SetOffset

func (d *Motor) SetOffset(offset bool)

SetOffset sets the offset.

func (*Motor) SetPWM

func (d *Motor) SetPWM(value uint32)

SetPWM sets the duty cycle.

func (*Motor) SetSpeed

func (d *Motor) SetSpeed(speed int) error

SetSpeed sets the motor speed.

func (*Motor) Stop

func (d *Motor) Stop() error

Stop stops the motor by setting the speed to 0.

type PCA9685

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

PCA9685 is a PCA9685 driver type.

func NewPCA9685

func NewPCA9685(busNumber int, addr uint8) (*PCA9685, error)

NewPCA9685 creates a new instance of the PCA9685 driver.

func (*PCA9685) Close

func (d *PCA9685) Close() error

Close cleans up all PCA9685 resources.

func (*PCA9685) Init

func (d *PCA9685) Init() error

Init the PCA9685 16-channel 12-bit PWM/Servo controller.

func (*PCA9685) Map

func (d *PCA9685) Map(x, inMin, inMax, outMin, outMax int16) int16

Map the value from one range to another.

func (*PCA9685) SetFreq

func (d *PCA9685) SetFreq(freq int) error

SetFreq sets the frequency.

func (*PCA9685) Write

func (d *PCA9685) Write(channel, on, off int16) error

Write writes data to a specific channel.

func (*PCA9685) WriteAll

func (d *PCA9685) WriteAll(on, off int16) error

WriteAll sets the on/off values for all channels.

Jump to

Keyboard shortcuts

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