Documentation

Overview

    Package us020 allows interfacing with the US020 ultrasonic range finder.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var NullThermometer = &nullThermometer{}

    Functions

    This section is empty.

    Types

    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.

            Source Files