v1

package
v0.0.0-...-be9965c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (

	// Instruction Types
	Ping      byte = 0x01
	ReadData  byte = 0x02
	WriteData byte = 0x03
	RegWrite  byte = 0x04
	Action    byte = 0x05
	Reset     byte = 0x06
	SyncWrite byte = 0x83

	// Send an instruction to all servos
	BroadcastIdent int = 0xFE // 254
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Proto1

type Proto1 struct {
	Network io.ReadWriter
}

func New

func New(network io.ReadWriter) *Proto1

func (*Proto1) Action

func (p *Proto1) Action() error

Action broadcasts the ACTION instruction, which initiates any previously bufferred instructions. Doesn't wait for a status packet in response, because they are not sent in response to broadcast instructions.

func (*Proto1) Ping

func (p *Proto1) Ping(ident int) error

Ping sends the PING instruction to the given Servo ID, and waits for the response. Returns an error if the ping fails, or nil if it succeeds.

func (*Proto1) ReadData

func (p *Proto1) ReadData(ident int, addr int, count int) ([]byte, error)

ReadData reads a slice of count bytes from the control table of the given servo ID. Use the bytesToInt function to convert the output to something more useful.

func (*Proto1) RegWrite

func (p *Proto1) RegWrite(ident int, address int, data []byte, expectResponse bool) error

func (*Proto1) SetBuffered

func (p *Proto1) SetBuffered(buffered bool)

func (*Proto1) WriteData

func (p *Proto1) WriteData(ident int, address int, data []byte, expectResponse bool) error

Jump to

Keyboard shortcuts

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