Back to godoc.org

Package us020

v0.0.0-...-d3d8c0c
Latest Go to latest

The latest major version is .

Published: May 8, 2017 | License: MIT | Module: github.com/kidoman/embd

Overview

Package us020 allows interfacing with the US020 ultrasonic range finder.

Index

Variables

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

Close.

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