Help us shape the future of Go! Take the 2026 Go Developer Survey

robots

package module
v1.0.1-0...-f7cc114 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

README

robots

Experimental code for robotics

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Motor

type Motor interface {
	// Return pins used to drive the motor
	Plus() gopi.GPIOPin
	Minus() gopi.GPIOPin

	// Return current speed
	Speed() float32
}

Motor is direct current motor interface

type Motors

type Motors interface {
	// Add a motor into the list of motors, indicting the GPIO pins for - and +
	// and whether the speed should be inverted (where the wires are mixed up)
	Add(minus, plus gopi.GPIOPin, invert bool) (Motor, error)

	// Run one or more motors at speed, which should be between -1.0 and 1.0
	// The function will return immediately, and the context can be used to cancel
	// the operation (and return the motors to 0)
	Run(ctx context.Context, speed float32, motors ...Motor) error

	// Set speed to zero for all running motors, or for specific motors
	Stop(motors ...Motor) error
}

Motors is a set of motors which can be controlled forwards, backwards or stopped

Directories

Path Synopsis
cmd
motor_ctrl command
sys

Jump to

Keyboard shortcuts

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