aio

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2017 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

README

AIO

This package provides drivers for Analog Input/Output (AIO) devices. It is normally used by connecting an adaptor such as firmata that supports the needed interfaces for analog devices.

Getting Started

Installing

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

Hardware Support

Gobot has a extensible system for connecting to hardware devices. The following AIO devices are currently supported:

  • Analog Sensor
  • Grove Light Sensor
  • Grove Rotary Dial
  • Grove Sound Sensor
  • Grove Temperature Sensor

More drivers are coming soon...

Documentation

Overview

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

Constants

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

Variables

View Source
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")
)

Functions

This section is empty.

Types

type AnalogReader

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

AnalogReader interface represents an Adaptor which has Analog capabilities

type AnalogSensorDriver

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

AnalogSensorDriver represents an Analog Sensor

func NewAnalogSensorDriver

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

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

Connection returns the AnalogSensorDrivers Connection

func (*AnalogSensorDriver) Halt

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

Halt stops polling the analog sensor for new information

func (*AnalogSensorDriver) Name

func (a *AnalogSensorDriver) Name() string

Name returns the AnalogSensorDrivers name

func (*AnalogSensorDriver) Pin

func (a *AnalogSensorDriver) Pin() string

Pin returns the AnalogSensorDrivers pin

func (*AnalogSensorDriver) Read

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

Read returns the current reading from the Analog Sensor

func (*AnalogSensorDriver) SetName

func (a *AnalogSensorDriver) SetName(n string)

SetName sets the AnalogSensorDrivers name

func (*AnalogSensorDriver) Start

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

type GroveLightSensorDriver struct {
	*AnalogSensorDriver
}

GroveLightSensorDriver represents an analog light sensor with a Grove connector

func NewGroveLightSensorDriver

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

type GrovePiezoVibrationSensorDriver struct {
	*AnalogSensorDriver
}

GrovePiezoVibrationSensorDriver represents an analog vibration sensor with a Grove connector

func NewGrovePiezoVibrationSensorDriver

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

type GroveRotaryDriver struct {
	*AnalogSensorDriver
}

GroveRotaryDriver represents an analog rotary dial with a Grove connector

func NewGroveRotaryDriver

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

type GroveSoundSensorDriver struct {
	*AnalogSensorDriver
}

GroveSoundSensorDriver represents a analog sound sensor with a Grove connector

func NewGroveSoundSensorDriver

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

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

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

func NewGroveTemperatureSensorDriver

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

Connection returns the GroveTemperatureSensorDrivers Connection

func (*GroveTemperatureSensorDriver) Halt

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

Halt stops polling the analog sensor for new information

func (*GroveTemperatureSensorDriver) Name

Name returns the GroveTemperatureSensorDrivers name

func (*GroveTemperatureSensorDriver) Pin

Pin returns the GroveTemperatureSensorDrivers pin

func (*GroveTemperatureSensorDriver) Read

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

Read returns the raw reading from the Sensor

func (*GroveTemperatureSensorDriver) SetName

func (a *GroveTemperatureSensorDriver) SetName(n string)

SetName sets the GroveTemperatureSensorDrivers name

func (*GroveTemperatureSensorDriver) Start

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

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

Read returns the current Temperature from the Sensor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL