Back to

Package us020

Latest Go to latest

The latest major version is .

Published: May 8, 2017 | License: MIT | Module:


Package us020 allows interfacing with the US020 ultrasonic range finder.



var NullThermometer = &nullThermometer{}

type Thermometer

type Thermometer interface {
	Temperature() (float64, error)

type US020

type US020 struct {
	EchoPin, TriggerPin embd.DigitalPin

	Thermometer Thermometer
	// contains filtered or unexported fields

US020 represents a US020 ultrasonic range finder.

func New

func New(echoPin, triggerPin embd.DigitalPin, thermometer Thermometer) *US020

New creates a new US020 interface. The bus variable controls the I2C bus used to communicate with the device.

func (*US020) Close

func (d *US020) Close() error


func (*US020) Distance

func (d *US020) Distance() (float64, error)

Distance computes the distance of the bot from the closest obstruction.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier