common

package
v0.0.0-...-174ef5a Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToServer

func ConnectToServer(host string) (net.Conn, error)

ConnectToServer is a helper function to connect to server

func SendServoPWM

func SendServoPWM(conn net.Conn, pin string, dc uint32) error

SendServoPWM sends servo position as PWM duty cycle (microseconds)

func SendServoPacket

func SendServoPacket(conn net.Conn, p ServoPacket) error

SendServoPacket sends a ServoPacket

func SendServoPosition

func SendServoPosition(conn net.Conn, pin string, pos float64) error

SendServoPosition sends servo position (0~100%) with presumed endpoint (1.0ms ~ 2.0ms)

func UpdatePWM

func UpdatePWM(rpi *raspi.Adaptor, p ServoPacket) error

UpdatePWM writes PWM cycle to specific pin stored in p

Types

type ServoPacket

type ServoPacket struct {
	PinNo     byte   // pin number on raspi
	DutyCycle uint32 // in micro-second
}

ServoPacket is a structure used to transfer pin and PWM duty cycle across network

func CreateServoPacket

func CreateServoPacket(pin string, pos float64) (*ServoPacket, error)

CreateServoPacket create a ServoPacket based on pin and position (0~100)

Jump to

Keyboard shortcuts

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