gopigo

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOTOR_ERR      = "motor_error"
	MOTOR_STOP     = "motor_stop"
	MOTOR_BACKWARD = "motor_backward"
	MOTOR_FORWARD  = "motor_forward"
	MOTOR_LEFT     = "motor_left"
	MOTOR_RIGHT    = "motor_right"

	LED_ERR = "led_error"
	LED_OFF = "led_off"
	LED_ON  = "led_on"

	BLINKER_ERR = "blinker_error"
	BLINKER_OFF = "blinker_off"
	BLINKER_ON  = "blinker_on"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gopigo added in v0.0.6

type Gopigo struct {
	Driver  *gopigo3.Driver
	Adaptor *raspi.Adaptor

	*LED
	*Motor
}

func New added in v0.0.6

func New() *Gopigo

type LED

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

LED is the led service object

func NewLED

func NewLED(driver *gopigo3.Driver) *LED

NewLED creates a new gopigo LED object for manipulating the bots lights

func (*LED) ApplyColor

func (l *LED) ApplyColor(c color.RGBA, light gopigo3.Led) error

ApplyColor sets the color of the gopigo's LED

func (l *LED) Blink(frequency time.Duration, done chan bool) error

Blink the lights on the robot at a specified interval

func (*LED) Wink

func (l *LED) Wink(frequency time.Duration, light gopigo3.Led) error

Wink a light on the robot at a specified interval

type LEDOption

type LEDOption func(*LED)

type Motor

type Motor struct {
	gobot.Eventer
	*gopigo3.Driver
}

func NewMotor

func NewMotor(driver *gopigo3.Driver) *Motor

NewMotor creates a new gopigo Motor

func (*Motor) Backward added in v0.0.6

func (m *Motor) Backward(speed uint) error

Backwards moves backwards at a default speed

func (*Motor) Forward

func (m *Motor) Forward(speed int) error

Forward moves the robot forwards

func (*Motor) Left

func (m *Motor) Left(speed int) error

Left moves the robot to the left

func (*Motor) Right

func (m *Motor) Right(speed int) error

Right moves the robot to the right

func (*Motor) State added in v0.0.6

func (m *Motor) State() map[string]MotorState

func (*Motor) Stop

func (m *Motor) Stop() error

Stop sets the motor dps to zero

type MotorState added in v0.0.6

type MotorState struct {
	Power uint16
	Speed int
}

Jump to

Keyboard shortcuts

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