embd: github.com/kidoman/embd/sensor/us020 Index | Files

package us020

import "github.com/kidoman/embd/sensor/us020"

Package us020 allows interfacing with the US020 ultrasonic range finder.

Index

Package Files

us020.go

Variables

var NullThermometer = &nullThermometer{}

type Thermometer Uses

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

type US020 Uses

type US020 struct {
    EchoPin, TriggerPin embd.DigitalPin

    Thermometer Thermometer
    // contains filtered or unexported fields
}

US020 represents a US020 ultrasonic range finder.

func New Uses

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 Uses

func (d *US020) Close() error

Close.

func (*US020) Distance Uses

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

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

Package us020 imports 4 packages (graph) and is imported by 1 packages. Updated 2016-07-16. Refresh now. Tools for package owners.