l9110x

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: BSD-3-Clause Imports: 1 Imported by: 26

Documentation

Overview

Package l9110x provides a driver to the L9110/L9110S H-bridge chip typically used to control DC motors.

Datasheet: https://www.elecrow.com/download/datasheet-l9110.pdf

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 is a motor without speed control. ia and ib are the directional pins.

func New

func New(direction1, direction2 machine.Pin) Device

New returns a new Motor driver for GPIO-only operation.

func (*Device) Backward

func (d *Device) Backward()

Backward turns motor on in backward direction.

func (*Device) Configure

func (d *Device) Configure()

Configure configures the Device.

func (*Device) Forward

func (d *Device) Forward()

Forward turns motor on in forward direction.

func (*Device) Stop

func (d *Device) Stop()

Stop turns motor off.

type PWM added in v0.16.0

type PWM interface {
	Configure(config machine.PWMConfig) error
	Channel(pin machine.Pin) (channel uint8, err error)
	Top() uint32
	Set(channel uint8, value uint32)
	SetPeriod(period uint64) error
}

PWM is the interface necessary for controlling the motor driver.

type PWMDevice

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

PWMDevice is a motor with speed control. ia and ib are the directional/speed PWM pins.

func NewWithSpeed

func NewWithSpeed(ca, cb uint8, pwm PWM) PWMDevice

NewWithSpeed returns a new PWMMotor driver that uses 2 PWM pins to control both direction and speed.

func (*PWMDevice) Backward

func (d *PWMDevice) Backward(speed uint32)

Backward turns motor on in backward direction at specific speed as a percentage.

func (*PWMDevice) Configure

func (d *PWMDevice) Configure() (err error)

Configure configures the PWMDevice. Note that the pins, PWM interface, and channels must all already be configured.

func (*PWMDevice) Forward

func (d *PWMDevice) Forward(speed uint32)

Forward turns motor on in forward direction at specific speed as a percentage.

func (*PWMDevice) Stop

func (d *PWMDevice) Stop()

Stop turns motor off.

Jump to

Keyboard shortcuts

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