arduino

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package arduino implements the arduino board and some peripherals.

Index

Constants

View Source
const SetPowerZeroThreshold = .0001

SetPowerZeroThreshold represents a power below which value attempting to run the motor simply stops it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Analogs    []board.AnalogConfig `json:"analogs,omitempty"`
	SerialPath string               `json:"serial_path"`
	Attributes config.AttributeMap  `json:"attributes,omitempty"`
}

A Config describes the configuration of a board and all of its connected parts.

func (*Config) Validate

func (config *Config) Validate(path string) error

Validate ensures all parts of the config are valid.

type Encoder

type Encoder struct {
	A, B string

	generic.Unimplemented
	// contains filtered or unexported fields
}

Encoder keeps track of an arduino motor position.

func NewEncoder

func NewEncoder(ctx context.Context, deps registry.Dependencies, config config.Component, logger golog.Logger) (*Encoder, error)

NewEncoder creates a new incremental Encoder.

func (*Encoder) Reset

func (e *Encoder) Reset(ctx context.Context, offset int64, extra map[string]interface{}) error

Reset sets the current position of the motor (adjusted by a given offset) to be its new zero position.

func (*Encoder) TicksCount

func (e *Encoder) TicksCount(ctx context.Context, extra map[string]interface{}) (int64, error)

TicksCount returns number of ticks since last zeroing.

type EncoderConfig

type EncoderConfig struct {
	Pins      EncoderPins `json:"pins"`
	BoardName string      `json:"board"`
	MotorName string      `json:"motor_name"`
}

EncoderConfig describes the config of an arduino Encoder.

func (*EncoderConfig) Validate added in v0.1.6

func (cfg *EncoderConfig) Validate(path string) ([]string, error)

Validate ensures all parts of the config are valid.

type EncoderPins

type EncoderPins struct {
	A string `json:"a"`
	B string `json:"b"`
}

EncoderPins defines the format the pin config should be in for Encoder.

Jump to

Keyboard shortcuts

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