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 gpio README: https://gobot.io/x/gobot/blob/master/platforms/aio/README.md
Index ¶
- Constants
- Variables
- type AnalogReader
- type AnalogSensorDriver
- func (a *AnalogSensorDriver) Connection() gobot.Connection
- func (a *AnalogSensorDriver) Halt() (err error)
- func (a *AnalogSensorDriver) Name() string
- func (a *AnalogSensorDriver) Pin() string
- func (a *AnalogSensorDriver) Read() (val int, err error)
- func (a *AnalogSensorDriver) SetName(n string)
- func (a *AnalogSensorDriver) Start() (err error)
- type GroveLightSensorDriver
- type GrovePiezoVibrationSensorDriver
- type GroveRotaryDriver
- type GroveSoundSensorDriver
- type GroveTemperatureSensorDriver
- func (a *GroveTemperatureSensorDriver) Connection() gobot.Connection
- func (a *GroveTemperatureSensorDriver) Halt() (err error)
- func (a *GroveTemperatureSensorDriver) Name() string
- func (a *GroveTemperatureSensorDriver) Pin() string
- func (a *GroveTemperatureSensorDriver) Read() (val int, err error)
- func (a *GroveTemperatureSensorDriver) SetName(n string)
- func (a *GroveTemperatureSensorDriver) Start() (err error)
- func (a *GroveTemperatureSensorDriver) Temperature() (val float64)
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") )
Functions ¶
This section is empty.
Types ¶
type AnalogReader ¶
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 ¶
func (a *GroveTemperatureSensorDriver) Connection() gobot.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 ¶
func (a *GroveTemperatureSensorDriver) Name() string
Name returns the GroveTemperatureSensorDrivers name
func (*GroveTemperatureSensorDriver) Pin ¶
func (a *GroveTemperatureSensorDriver) Pin() string
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