usbrelay

package module
v0.0.0-...-8219d79 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-usb-relay-driver

godoc reference

Pure Go USB relay driver for cheap usb hid interface relay

Linux x86/amd64/armv5 is supported for now.

Install
go get -v -u github.com/mengzhuo/go-usb-relay/g-relay
g-relay -h
# turn on num 1
g-relay -n 1 -o

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SlotNumberOverflow = errors.New("slot should be in 1 to 8")
)

Functions

func ListAll

func ListAll() (map[string]*Relay, error)

Types

type Relay

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

func (*Relay) Close

func (r *Relay) Close()

func (*Relay) Device

func (r *Relay) Device() hid.Device

func (*Relay) GetAllStatus

func (r *Relay) GetAllStatus() (bitmask byte, err error)

func (*Relay) Id

func (r *Relay) Id() (id string, err error)

func (*Relay) SlotNum

func (r *Relay) SlotNum() int

func (*Relay) Status

func (r *Relay) Status(n int) (on bool, err error)

func (*Relay) Toggle

func (r *Relay) Toggle(n int) (err error)

func (*Relay) TurnAllOff

func (r *Relay) TurnAllOff() (err error)

func (*Relay) TurnAllOn

func (r *Relay) TurnAllOn() (err error)

func (*Relay) TurnOff

func (r *Relay) TurnOff(n int) (err error)

func (*Relay) TurnOn

func (r *Relay) TurnOn(n int) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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