led

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.led",
	eng.ComponentFactoryFunc(func(ref v0.ComponentRef) (v0.Component, error) {
		return NewComponent(ref)
	})).
	Describe("[GoBot] GPIO LED").
	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 led 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) SetPower

func (s *Component) SetPower(state State)

SetPower sets the power state

func (*Component) Type

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

Type implements v0.Component

type Config

type Config struct {
	Pin string `map:"pin"`
}

Config defines led configuration

type State

type State struct {
	On         bool  `json:"on"`
	Brightness *byte `json:"brightness,omitempty"`
}

State presents LED state

Jump to

Keyboard shortcuts

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