gobot: gobot.io/x/gobot/drivers/aio Index | Files

package aio

import "gobot.io/x/gobot/drivers/aio"

Package aio provides Gobot drivers for Analog Input/Output devices.

Installing:

go get -d -u gobot.io/x/gobot

For further information refer to aio README: https://github.com/hybridgroup/gobot/blob/master/platforms/aio/README.md

Index

Package Files

aio.go analog_sensor_driver.go doc.go grove_drivers.go grove_temperature_sensor_driver.go

Constants

const (
    // Error event
    Error = "error"
    // Data event
    Data = "data"
    // Vibration event
    Vibration = "vibration"
)

Variables

var (
    // ErrAnalogReadUnsupported is error resulting when a driver attempts to use
    // hardware capabilities which a connection does not support
    ErrAnalogReadUnsupported = errors.New("AnalogRead is not supported by this platform")
)

type AnalogReader Uses

type AnalogReader interface {
    //gobot.Adaptor
    AnalogRead(string) (val int, err error)
}

AnalogReader interface represents an Adaptor which has Analog capabilities

type AnalogSensorDriver Uses

type AnalogSensorDriver struct {
    gobot.Eventer
    gobot.Commander
    // contains filtered or unexported fields
}

AnalogSensorDriver represents an Analog Sensor

func NewAnalogSensorDriver Uses

func NewAnalogSensorDriver(a AnalogReader, pin string, v ...time.Duration) *AnalogSensorDriver

NewAnalogSensorDriver returns a new AnalogSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the AnalogSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

func (*AnalogSensorDriver) Connection Uses

func (a *AnalogSensorDriver) Connection() gobot.Connection

Connection returns the AnalogSensorDrivers Connection

func (*AnalogSensorDriver) Halt Uses

func (a *AnalogSensorDriver) Halt() (err error)

Halt stops polling the analog sensor for new information

func (*AnalogSensorDriver) Name Uses

func (a *AnalogSensorDriver) Name() string

Name returns the AnalogSensorDrivers name

func (*AnalogSensorDriver) Pin Uses

func (a *AnalogSensorDriver) Pin() string

Pin returns the AnalogSensorDrivers pin

func (*AnalogSensorDriver) Read Uses

func (a *AnalogSensorDriver) Read() (val int, err error)

Read returns the current reading from the Analog Sensor

func (*AnalogSensorDriver) SetName Uses

func (a *AnalogSensorDriver) SetName(n string)

SetName sets the AnalogSensorDrivers name

func (*AnalogSensorDriver) Start Uses

func (a *AnalogSensorDriver) Start() (err error)

Start starts the AnalogSensorDriver and reads the Analog Sensor at the given interval. Emits the Events:

Data int - Event is emitted on change and represents the current reading from the sensor.
Error error - Event is emitted on error reading from the sensor.

type GroveLightSensorDriver Uses

type GroveLightSensorDriver struct {
    *AnalogSensorDriver
}

GroveLightSensorDriver represents an analog light sensor with a Grove connector

func NewGroveLightSensorDriver Uses

func NewGroveLightSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GroveLightSensorDriver

NewGroveLightSensorDriver returns a new GroveLightSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the AnalogSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

type GrovePiezoVibrationSensorDriver Uses

type GrovePiezoVibrationSensorDriver struct {
    *AnalogSensorDriver
}

GrovePiezoVibrationSensorDriver represents an analog vibration sensor with a Grove connector

func NewGrovePiezoVibrationSensorDriver Uses

func NewGrovePiezoVibrationSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GrovePiezoVibrationSensorDriver

NewGrovePiezoVibrationSensorDriver returns a new GrovePiezoVibrationSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the AnalogSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

type GroveRotaryDriver Uses

type GroveRotaryDriver struct {
    *AnalogSensorDriver
}

GroveRotaryDriver represents an analog rotary dial with a Grove connector

func NewGroveRotaryDriver Uses

func NewGroveRotaryDriver(a AnalogReader, pin string, v ...time.Duration) *GroveRotaryDriver

NewGroveRotaryDriver returns a new GroveRotaryDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the AnalogSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

type GroveSoundSensorDriver Uses

type GroveSoundSensorDriver struct {
    *AnalogSensorDriver
}

GroveSoundSensorDriver represents a analog sound sensor with a Grove connector

func NewGroveSoundSensorDriver Uses

func NewGroveSoundSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GroveSoundSensorDriver

NewGroveSoundSensorDriver returns a new GroveSoundSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the AnalogSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

type GroveTemperatureSensorDriver Uses

type GroveTemperatureSensorDriver struct {
    gobot.Eventer
    // contains filtered or unexported fields
}

GroveTemperatureSensorDriver represents a Temperature Sensor The temperature is reported in degree Celsius

func NewGroveTemperatureSensorDriver Uses

func NewGroveTemperatureSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GroveTemperatureSensorDriver

NewGroveTemperatureSensorDriver returns a new GroveTemperatureSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader and pin.

Optionally accepts:

time.Duration: Interval at which the TemperatureSensor is polled for new information

Adds the following API Commands:

"Read" - See AnalogSensor.Read

func (*GroveTemperatureSensorDriver) Connection Uses

func (a *GroveTemperatureSensorDriver) Connection() gobot.Connection

Connection returns the GroveTemperatureSensorDrivers Connection

func (*GroveTemperatureSensorDriver) Halt Uses

func (a *GroveTemperatureSensorDriver) Halt() (err error)

Halt stops polling the analog sensor for new information

func (*GroveTemperatureSensorDriver) Name Uses

func (a *GroveTemperatureSensorDriver) Name() string

Name returns the GroveTemperatureSensorDrivers name

func (*GroveTemperatureSensorDriver) Pin Uses

func (a *GroveTemperatureSensorDriver) Pin() string

Pin returns the GroveTemperatureSensorDrivers pin

func (*GroveTemperatureSensorDriver) Read Uses

func (a *GroveTemperatureSensorDriver) Read() (val int, err error)

Read returns the raw reading from the Sensor

func (*GroveTemperatureSensorDriver) SetName Uses

func (a *GroveTemperatureSensorDriver) SetName(n string)

SetName sets the GroveTemperatureSensorDrivers name

func (*GroveTemperatureSensorDriver) Start Uses

func (a *GroveTemperatureSensorDriver) Start() (err error)

Start starts the GroveTemperatureSensorDriver and reads the Sensor at the given interval. Emits the Events:

Data int - Event is emitted on change and represents the current temperature in celsius from the sensor.
Error error - Event is emitted on error reading from the sensor.

func (*GroveTemperatureSensorDriver) Temperature Uses

func (a *GroveTemperatureSensorDriver) Temperature() (val float64)

Read returns the current Temperature from the Sensor

Package aio imports 4 packages (graph). Updated 2018-02-15. Refresh now. Tools for package owners.