sensors

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sensors implements code to read various sensors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TOF10120

type TOF10120 struct {
	// contains filtered or unexported fields
}

TOF10120 is a driver for a TOF10120 sensor

func NewTOF10120

func NewTOF10120(port io.ReadWriter) *TOF10120

NewTOF10120 creates a instance to initialize and read the TOF sensor port must return an entire packet for each Read(). github.com/simpleiot/simpleiot/respreader is a good way to do this.

func (*TOF10120) Read

func (tof *TOF10120) Read(dataCallback func(dist int),
	errCallback func(err error)) error

Read returns the distance in mm. The sensor continuously ouputs readings so the callback is called each time a new reading is read.

func (*TOF10120) SetSendInterval

func (tof *TOF10120) SetSendInterval(interval int) error

SetSendInterval sets the interval at which sensor sends data 10-9999ms, default 100ms this should be called before Read() is started

Jump to

Keyboard shortcuts

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