servo

package
v0.0.0-...-bb4fd4e Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	Servos []*Servo `json:"servos"`
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector(controlUrl string, dataSource string,
	layout *template.Template,
	count int) (conn *Connector)

func (*Connector) Connect

func (conn *Connector) Connect(indeces ...uint) (servos []*Servo, err error)

func (*Connector) Count

func (conn *Connector) Count() int

func (*Connector) Initialize

func (conn *Connector) Initialize()

func (*Connector) Load

func (conn *Connector) Load(dataSource string) (err error)

func (*Connector) Save

func (conn *Connector) Save(dataSource string) (err error)

type Position

type Position struct {
	Max  int
	Step int
}

type Servo

type Servo struct {
	Index        uint         `json:"index"`
	Title        string       `json:"title"`
	ControlUrl   string       `json:"controlUrl"`
	Settings     Settings     `json:"settings"`
	Command      ServoCommand `json:"command"`
	Angle        uint         `json:"angle"`
	Speed        uint         `json:"speed"`
	EaseType     uint         `json:"easeType"`
	SettingForms forms.Forms  `json:"-"`
	CommandForms forms.Forms  `json:"-"`
}

func (*Servo) Apply

func (svo *Servo) Apply(w http.ResponseWriter)

func (*Servo) Connect

func (svo *Servo) Connect(router *mux.Router, prefix string)

func (*Servo) Ease

func (svo *Servo) Ease(w http.ResponseWriter, r *http.Request)

func (*Servo) Home

func (svo *Servo) Home(w http.ResponseWriter, r *http.Request)

func (*Servo) Move

func (svo *Servo) Move(w http.ResponseWriter, r *http.Request)

func (*Servo) Stop

func (svo *Servo) Stop(w http.ResponseWriter, r *http.Request)

func (*Servo) Test

func (svo *Servo) Test(w http.ResponseWriter, r *http.Request)

type ServoCommand

type ServoCommand uint
const (
	ServoBase ServoCommand = iota
	ServoHome
	ServoMove
	ServoEase
	ServoTest
	ServoStop
	ServoMax
)

func ServoCommands

func ServoCommands() []ServoCommand

func (ServoCommand) String

func (svoc ServoCommand) String() string

type Settings

type Settings struct {
	Step   int  `json:"step"`
	Min    int  `json:"min"`
	Max    int  `json:"max"`
	Invert bool `json:"invert"`
}

{{$dY:=15}}{{$dX:=15}}{{$maxX:=180}}{{$maxY:=180}}{{$orgX:=0}}{{$orgY:=0}}{{$speed:=60}}

func (*Settings) Calc

func (set *Settings) Calc(stepCount int) (pos *Position)

Jump to

Keyboard shortcuts

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