motor

package
v0.0.0-...-fab637b Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Type = eng.DefineComponentType("gobot.gpio.motor",
	eng.ComponentFactoryFunc(func(ref v0.ComponentRef) (v0.Component, error) {
		return NewComponent(ref)
	})).
	Describe("[GoBot] GPIO Motor").
	Register()

Type is the Component type

Functions

func NewComponent

func NewComponent(ref v0.ComponentRef) (v0.Component, error)

NewComponent creates a Component

Types

type Component

type Component struct {
	Config
	Adapter cmn.Adapter `inject:"gpio" map:"-"`
	// contains filtered or unexported fields
}

Component is the implement of motor Component

func (*Component) Endpoints

func (s *Component) Endpoints() []mqhub.Endpoint

Endpoints implements v0.Stateful

func (*Component) Ref

func (s *Component) Ref() v0.ComponentRef

Ref implements v0.Component

func (*Component) SetSpeed

func (s *Component) SetSpeed(speed float32)

SetSpeed set the motor speed, speed is -1.0 ~ 1.0

func (*Component) Type

func (s *Component) Type() v0.ComponentType

Type implements v0.Component

type Config

type Config struct {
	Pin     string  `map:"pin"`
	DirPin  string  `map:"dir-pin"`
	Mode    *string `map:"mode"`
	Reverse bool    `map:"reverse"`
}

Config defines motor configuration

Jump to

Keyboard shortcuts

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