Documentation ¶
Overview ¶
Package gpio provides Gobot drivers for General Purpose Input/Output devices.
Installing:
go get -d -u github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/gpio
For further information refer to gpio README: https://github.com/hybridgroup/gobot/blob/master/platforms/gpio/README.md
Index ¶
- Constants
- Variables
- type AnalogReader
- type AnalogSensorDriver
- func (a *AnalogSensorDriver) Connection() gobot.Connection
- func (a *AnalogSensorDriver) Halt() (errs []error)
- func (a *AnalogSensorDriver) Name() string
- func (a *AnalogSensorDriver) Pin() string
- func (a *AnalogSensorDriver) Read() (val int, err error)
- func (a *AnalogSensorDriver) Start() (errs []error)
- type ButtonDriver
- type BuzzerDriver
- func (l *BuzzerDriver) Connection() gobot.Connection
- func (l *BuzzerDriver) Halt() (errs []error)
- func (l *BuzzerDriver) Name() string
- func (l *BuzzerDriver) Off() (err error)
- func (l *BuzzerDriver) On() (err error)
- func (l *BuzzerDriver) Pin() string
- func (l *BuzzerDriver) Start() (errs []error)
- func (l *BuzzerDriver) State() bool
- func (l *BuzzerDriver) Toggle() (err error)
- func (l *BuzzerDriver) Tone(hz, duration float64) (err error)
- type DigitalReader
- type DigitalWriter
- type DirectPinDriver
- func (d *DirectPinDriver) AnalogRead() (val int, err error)
- func (d *DirectPinDriver) Connection() gobot.Connection
- func (d *DirectPinDriver) DigitalRead() (val int, err error)
- func (d *DirectPinDriver) DigitalWrite(level byte) (err error)
- func (d *DirectPinDriver) Halt() (errs []error)
- func (d *DirectPinDriver) Name() string
- func (d *DirectPinDriver) Pin() string
- func (d *DirectPinDriver) PwmWrite(level byte) (err error)
- func (d *DirectPinDriver) ServoWrite(level byte) (err error)
- func (d *DirectPinDriver) Start() (errs []error)
- type GroveButtonDriver
- type GroveBuzzerDriver
- type GroveLedDriver
- type GroveLightSensorDriver
- type GrovePiezoVibrationSensorDriver
- type GroveRelayDriver
- type GroveRotaryDriver
- type GroveSoundSensorDriver
- type GroveTemperatureSensorDriver
- func (a *GroveTemperatureSensorDriver) Connection() gobot.Connection
- func (a *GroveTemperatureSensorDriver) Halt() (errs []error)
- func (a *GroveTemperatureSensorDriver) Name() string
- func (a *GroveTemperatureSensorDriver) Pin() string
- func (a *GroveTemperatureSensorDriver) Read() (val int, err error)
- func (a *GroveTemperatureSensorDriver) Start() (errs []error)
- func (a *GroveTemperatureSensorDriver) Temperature() (val float64)
- type GroveTouchDriver
- type LedDriver
- func (l *LedDriver) Brightness(level byte) (err error)
- func (l *LedDriver) Connection() gobot.Connection
- func (l *LedDriver) Halt() (errs []error)
- func (l *LedDriver) Name() string
- func (l *LedDriver) Off() (err error)
- func (l *LedDriver) On() (err error)
- func (l *LedDriver) Pin() string
- func (l *LedDriver) Start() (errs []error)
- func (l *LedDriver) State() bool
- func (l *LedDriver) Toggle() (err error)
- type MakeyButtonDriver
- type MotorDriver
- func (m *MotorDriver) Backward(speed byte) (err error)
- func (m *MotorDriver) Connection() gobot.Connection
- func (m *MotorDriver) Direction(direction string) (err error)
- func (m *MotorDriver) Forward(speed byte) (err error)
- func (m *MotorDriver) Halt() (errs []error)
- func (m *MotorDriver) IsOff() bool
- func (m *MotorDriver) IsOn() bool
- func (m *MotorDriver) Max() (err error)
- func (m *MotorDriver) Min() (err error)
- func (m *MotorDriver) Name() string
- func (m *MotorDriver) Off() (err error)
- func (m *MotorDriver) On() (err error)
- func (m *MotorDriver) Speed(value byte) (err error)
- func (m *MotorDriver) Start() (errs []error)
- func (m *MotorDriver) Toggle() (err error)
- type PwmWriter
- type RelayDriver
- func (l *RelayDriver) Connection() gobot.Connection
- func (l *RelayDriver) Halt() (errs []error)
- func (l *RelayDriver) Name() string
- func (l *RelayDriver) Off() (err error)
- func (l *RelayDriver) On() (err error)
- func (l *RelayDriver) Pin() string
- func (l *RelayDriver) Start() (errs []error)
- func (l *RelayDriver) State() bool
- func (l *RelayDriver) Toggle() (err error)
- type ServoDriver
- func (s *ServoDriver) Center() (err error)
- func (s *ServoDriver) Connection() gobot.Connection
- func (s *ServoDriver) Halt() (errs []error)
- func (s *ServoDriver) Max() (err error)
- func (s *ServoDriver) Min() (err error)
- func (s *ServoDriver) Move(angle uint8) (err error)
- func (s *ServoDriver) Name() string
- func (s *ServoDriver) Pin() string
- func (s *ServoDriver) Start() (errs []error)
- type ServoWriter
Constants ¶
const ( Whole = 4 Half = 2 Quarter = 1 Eighth = 0.500 )
const ( Rest = 0 C0 = 16.35 Db0 = 17.32 D0 = 18.35 Eb0 = 19.45 E0 = 20.60 F0 = 21.83 Gb0 = 23.12 G0 = 24.50 Ab0 = 25.96 A0 = 27.50 Bb0 = 29.14 B0 = 30.87 C1 = 32.70 Db1 = 34.65 D1 = 36.71 Eb1 = 38.89 E1 = 41.20 F1 = 43.65 Gb1 = 46.25 G1 = 49.00 Ab1 = 51.91 A1 = 55.00 Bb1 = 58.27 B1 = 61.74 C2 = 65.41 Db2 = 69.30 D2 = 73.42 Eb2 = 77.78 E2 = 82.41 F2 = 87.31 Gb2 = 92.50 G2 = 98.00 Ab2 = 103.83 A2 = 110.00 Bb2 = 116.54 B2 = 123.47 C3 = 130.81 Db3 = 138.59 D3 = 146.83 Eb3 = 155.56 E3 = 164.81 F3 = 174.61 Gb3 = 185.00 G3 = 196.00 Ab3 = 207.65 A3 = 220.00 Bb3 = 233.08 B3 = 246.94 C4 = 261.63 Db4 = 277.18 D4 = 293.66 Eb4 = 311.13 E4 = 329.63 F4 = 349.23 Gb4 = 369.99 G4 = 392.00 Ab4 = 415.30 A4 = 440.00 Bb4 = 466.16 B4 = 493.88 C5 = 523.25 Db5 = 554.37 D5 = 587.33 Eb5 = 622.25 E5 = 659.25 F5 = 698.46 Gb5 = 739.99 G5 = 783.99 Ab5 = 830.61 A5 = 880.00 Bb5 = 932.33 B5 = 987.77 C6 = 1046.50 Db6 = 1108.73 D6 = 1174.66 Eb6 = 1244.51 E6 = 1318.51 F6 = 1396.91 Gb6 = 1479.98 G6 = 1567.98 Ab6 = 1661.22 A6 = 1760.00 Bb6 = 1864.66 B6 = 1975.53 C7 = 2093.00 Db7 = 2217.46 D7 = 2349.32 Eb7 = 2489.02 E7 = 2637.02 F7 = 2793.83 Gb7 = 2959.96 G7 = 3135.96 Ab7 = 3322.44 A7 = 3520.00 Bb7 = 3729.31 B7 = 3951.07 C8 = 4186.01 Db8 = 4434.92 D8 = 4698.63 Eb8 = 4978.03 E8 = 5274.04 F8 = 5587.65 Gb8 = 5919.91 G8 = 6271.93 Ab8 = 6644.88 A8 = 7040.00 Bb8 = 7458.62 B8 = 7902.13 )
const ( // Release event Release = "release" // Push event Push = "push" // Error event Error = "error" // Data event Data = "data" // Vibration event Vibration = "vibration" )
Variables ¶
var ( // ErrServoWriteUnsupported is the error resulting when a driver attempts to use // hardware capabilities which a connection does not support ErrServoWriteUnsupported = errors.New("ServoWrite is not supported by this platform") // ErrPwmWriteUnsupported is the error resulting when a driver attempts to use // hardware capabilities which a connection does not support ErrPwmWriteUnsupported = errors.New("PwmWrite is not supported by this platform") // 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") // ErrDigitalWriteUnsupported is the error resulting when a driver attempts to use // hardware capabilities which a connection does not support ErrDigitalWriteUnsupported = errors.New("DigitalWrite is not supported by this platform") // ErrDigitalReadUnsupported is the error resulting when a driver attempts to use // hardware capabilities which a connection does not support ErrDigitalReadUnsupported = errors.New("DigitalRead is not supported by this platform") // ErrServoOutOfRange is the error resulting when a driver attempts to use // hardware capabilities which a connection does not support ErrServoOutOfRange = errors.New("servo angle must be between 0-180") )
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, name string, pin string, v ...time.Duration) *AnalogSensorDriver
NewAnalogSensorDriver returns a new AnalogSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader, name and pin.
Optinally 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() (errs []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) Start ¶
func (a *AnalogSensorDriver) Start() (errs []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 ButtonDriver ¶
ButtonDriver Represents a digital Button
func NewButtonDriver ¶
func NewButtonDriver(a DigitalReader, name string, pin string, v ...time.Duration) *ButtonDriver
NewButtonDriver returns a new ButtonDriver with a polling interval of 10 Milliseconds given a DigitalReader, name and pin.
Optinally accepts:
time.Duration: Interval at which the ButtonDriver is polled for new information
func (*ButtonDriver) Connection ¶
func (b *ButtonDriver) Connection() gobot.Connection
Connection returns the ButtonDrivers Connection
func (*ButtonDriver) Halt ¶
func (b *ButtonDriver) Halt() (errs []error)
Halt stops polling the button for new information
func (*ButtonDriver) Name ¶
func (b *ButtonDriver) Name() string
Name returns the ButtonDrivers name
func (*ButtonDriver) Start ¶
func (b *ButtonDriver) Start() (errs []error)
Start starts the ButtonDriver and polls the state of the button at the given interval.
Emits the Events:
Push int - On button push Release int - On button release Error error - On button error
type BuzzerDriver ¶
type BuzzerDriver struct { BPM float64 // contains filtered or unexported fields }
BuzzerDriver represents a digital buzzer
func NewBuzzerDriver ¶
func NewBuzzerDriver(a DigitalWriter, name string, pin string) *BuzzerDriver
NewBuzzerDriver return a new BuzzerDriver given a DigitalWriter, name and pin.
func (*BuzzerDriver) Connection ¶
func (l *BuzzerDriver) Connection() gobot.Connection
Connection returns the BuzzerDrivers Connection
func (*BuzzerDriver) Halt ¶
func (l *BuzzerDriver) Halt() (errs []error)
Halt implements the Driver interface
func (*BuzzerDriver) Name ¶
func (l *BuzzerDriver) Name() string
Name returns the BuzzerDrivers name
func (*BuzzerDriver) Off ¶
func (l *BuzzerDriver) Off() (err error)
Off sets the buzzer to a low state.
func (*BuzzerDriver) On ¶
func (l *BuzzerDriver) On() (err error)
On sets the buzzer to a high state.
func (*BuzzerDriver) Start ¶
func (l *BuzzerDriver) Start() (errs []error)
Start implements the Driver interface
func (*BuzzerDriver) State ¶
func (l *BuzzerDriver) State() bool
State return true if the buzzer is On and false if the led is Off
func (*BuzzerDriver) Toggle ¶
func (l *BuzzerDriver) Toggle() (err error)
Toggle sets the buzzer to the opposite of it's current state
func (*BuzzerDriver) Tone ¶
func (l *BuzzerDriver) Tone(hz, duration float64) (err error)
type DigitalReader ¶
DigitalReader interface represents an Adaptor which has DigitalRead capabilities
type DigitalWriter ¶
DigitalWriter interface represents an Adaptor which has DigitalWrite capabilities
type DirectPinDriver ¶
DirectPinDriver represents a GPIO pin
func NewDirectPinDriver ¶
func NewDirectPinDriver(a gobot.Connection, name string, pin string) *DirectPinDriver
NewDirectPinDriver return a new DirectPinDriver given a Connection, name and pin.
Adds the following API Commands:
"DigitalRead" - See DirectPinDriver.DigitalRead "DigitalWrite" - See DirectPinDriver.DigitalWrite "AnalogRead" - See DirectPinDriver.AnalogRead "AnalogWrite" - See DirectPinDriver.AnalogWrite "PwmWrite" - See DirectPinDriver.PwmWrite "ServoWrite" - See DirectPinDriver.ServoWrite
func (*DirectPinDriver) AnalogRead ¶
func (d *DirectPinDriver) AnalogRead() (val int, err error)
AnalogRead reads the current analog reading of the pin
func (*DirectPinDriver) Connection ¶
func (d *DirectPinDriver) Connection() gobot.Connection
Connection returns the DirectPinDrivers Connection
func (*DirectPinDriver) DigitalRead ¶
func (d *DirectPinDriver) DigitalRead() (val int, err error)
DigitalRead returns the current digital state of the pin
func (*DirectPinDriver) DigitalWrite ¶
func (d *DirectPinDriver) DigitalWrite(level byte) (err error)
DigitalWrite writes to the pin. Acceptable values are 1 or 0
func (*DirectPinDriver) Halt ¶
func (d *DirectPinDriver) Halt() (errs []error)
Halt implements the Driver interface
func (*DirectPinDriver) Name ¶
func (d *DirectPinDriver) Name() string
Name returns the DirectPinDrivers name
func (*DirectPinDriver) Pin ¶
func (d *DirectPinDriver) Pin() string
Pin returns the DirectPinDrivers pin
func (*DirectPinDriver) PwmWrite ¶
func (d *DirectPinDriver) PwmWrite(level byte) (err error)
PwmWrite writes the 0-254 value to the specified pin
func (*DirectPinDriver) ServoWrite ¶
func (d *DirectPinDriver) ServoWrite(level byte) (err error)
ServoWrite writes value to the specified pin
func (*DirectPinDriver) Start ¶
func (d *DirectPinDriver) Start() (errs []error)
Start implements the Driver interface
type GroveButtonDriver ¶
type GroveButtonDriver struct {
*ButtonDriver
}
func NewGroveButtonDriver ¶
func NewGroveButtonDriver(a DigitalReader, name string, pin string, v ...time.Duration) *GroveButtonDriver
type GroveBuzzerDriver ¶
type GroveBuzzerDriver struct {
*BuzzerDriver
}
func NewGroveBuzzerDriver ¶
func NewGroveBuzzerDriver(a DigitalWriter, name string, pin string) *GroveBuzzerDriver
type GroveLedDriver ¶
type GroveLedDriver struct {
*LedDriver
}
func NewGroveLedDriver ¶
func NewGroveLedDriver(a DigitalWriter, name string, pin string) *GroveLedDriver
type GroveLightSensorDriver ¶
type GroveLightSensorDriver struct {
*AnalogSensorDriver
}
func NewGroveLightSensorDriver ¶
func NewGroveLightSensorDriver(a AnalogReader, name string, pin string, v ...time.Duration) *GroveLightSensorDriver
type GrovePiezoVibrationSensorDriver ¶
type GrovePiezoVibrationSensorDriver struct {
*AnalogSensorDriver
}
func NewGrovePiezoVibrationSensorDriver ¶
func NewGrovePiezoVibrationSensorDriver(a AnalogReader, name string, pin string, v ...time.Duration) *GrovePiezoVibrationSensorDriver
type GroveRelayDriver ¶
type GroveRelayDriver struct {
*RelayDriver
}
func NewGroveRelayDriver ¶
func NewGroveRelayDriver(a DigitalWriter, name string, pin string) *GroveRelayDriver
type GroveRotaryDriver ¶
type GroveRotaryDriver struct {
*AnalogSensorDriver
}
func NewGroveRotaryDriver ¶
func NewGroveRotaryDriver(a AnalogReader, name string, pin string, v ...time.Duration) *GroveRotaryDriver
type GroveSoundSensorDriver ¶
type GroveSoundSensorDriver struct {
*AnalogSensorDriver
}
func NewGroveSoundSensorDriver ¶
func NewGroveSoundSensorDriver(a AnalogReader, name string, pin string, v ...time.Duration) *GroveSoundSensorDriver
type GroveTemperatureSensorDriver ¶
type GroveTemperatureSensorDriver struct { gobot.Eventer // contains filtered or unexported fields }
GroveTemperatureSensorDriver represents a Temperature Sensor
func NewGroveTemperatureSensorDriver ¶
func NewGroveTemperatureSensorDriver(a AnalogReader, name string, pin string, v ...time.Duration) *GroveTemperatureSensorDriver
NewGroveTemperatureSensorDriver returns a new GroveTemperatureSensorDriver with a polling interval of 10 Milliseconds given an AnalogReader, name and pin.
Optinally 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() (errs []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) Start ¶
func (a *GroveTemperatureSensorDriver) Start() (errs []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
type GroveTouchDriver ¶
type GroveTouchDriver struct {
*ButtonDriver
}
func NewGroveTouchDriver ¶
func NewGroveTouchDriver(a DigitalReader, name string, pin string, v ...time.Duration) *GroveTouchDriver
type LedDriver ¶
LedDriver represents a digital Led
func NewLedDriver ¶
func NewLedDriver(a DigitalWriter, name string, pin string) *LedDriver
NewLedDriver return a new LedDriver given a DigitalWriter, name and pin.
Adds the following API Commands:
"Brightness" - See LedDriver.Brightness "Toggle" - See LedDriver.Toggle "On" - See LedDriver.On "Off" - See LedDriver.Off
func (*LedDriver) Brightness ¶
Brightness sets the led to the specified level of brightness
func (*LedDriver) Connection ¶
func (l *LedDriver) Connection() gobot.Connection
Connection returns the LedDrivers Connection
type MakeyButtonDriver ¶
type MakeyButtonDriver struct { Active bool gobot.Eventer // contains filtered or unexported fields }
MakeyButtonDriver Represents a Makey Button
func NewMakeyButtonDriver ¶
func NewMakeyButtonDriver(a DigitalReader, name string, pin string, v ...time.Duration) *MakeyButtonDriver
NewMakeyButtonDriver returns a new MakeyButtonDriver with a polling interval of 10 Milliseconds given a DigitalReader, name and pin.
Optinally accepts:
time.Duration: Interval at which the ButtonDriver is polled for new information
func (*MakeyButtonDriver) Connection ¶
func (b *MakeyButtonDriver) Connection() gobot.Connection
Connection returns the MakeyButtonDrivers Connection
func (*MakeyButtonDriver) Halt ¶
func (b *MakeyButtonDriver) Halt() (errs []error)
Halt stops polling the makey button for new information
func (*MakeyButtonDriver) Name ¶
func (b *MakeyButtonDriver) Name() string
Name returns the MakeyButtonDrivers name
func (*MakeyButtonDriver) Pin ¶
func (b *MakeyButtonDriver) Pin() string
Pin returns the MakeyButtonDrivers pin
func (*MakeyButtonDriver) Start ¶
func (b *MakeyButtonDriver) Start() (errs []error)
Start starts the MakeyButtonDriver and polls the state of the button at the given interval.
Emits the Events:
Push int - On button push Release int - On button release Error error - On button error
type MotorDriver ¶
type MotorDriver struct { SpeedPin string SwitchPin string DirectionPin string ForwardPin string BackwardPin string CurrentState byte CurrentSpeed byte CurrentMode string CurrentDirection string // contains filtered or unexported fields }
MotorDriver Represents a Motor
func NewMotorDriver ¶
func NewMotorDriver(a DigitalWriter, name string, speedPin string) *MotorDriver
NewMotorDriver return a new MotorDriver given a DigitalWriter, name and pin
func (*MotorDriver) Backward ¶
func (m *MotorDriver) Backward(speed byte) (err error)
Backward sets the backward pin to the specified speed
func (*MotorDriver) Connection ¶
func (m *MotorDriver) Connection() gobot.Connection
Connection returns the MotorDrivers Connection
func (*MotorDriver) Direction ¶
func (m *MotorDriver) Direction(direction string) (err error)
Direction sets the direction pin to the specified speed
func (*MotorDriver) Forward ¶
func (m *MotorDriver) Forward(speed byte) (err error)
Forward sets the forward pin to the specified speed
func (*MotorDriver) Halt ¶
func (m *MotorDriver) Halt() (errs []error)
Halt implements the Driver interface
func (*MotorDriver) IsOff ¶
func (m *MotorDriver) IsOff() bool
IsOff returns true if the motor is off
func (*MotorDriver) Max ¶
func (m *MotorDriver) Max() (err error)
Max sets the motor to the maximum speed
func (*MotorDriver) Min ¶
func (m *MotorDriver) Min() (err error)
Min sets the motor to the minimum speed
func (*MotorDriver) Off ¶
func (m *MotorDriver) Off() (err error)
Off turns the motor off or sets the motor to a 0 speed
func (*MotorDriver) On ¶
func (m *MotorDriver) On() (err error)
On turns the motor on or sets the motor to a maximum speed
func (*MotorDriver) Speed ¶
func (m *MotorDriver) Speed(value byte) (err error)
Speed sets the speed of the motor
func (*MotorDriver) Start ¶
func (m *MotorDriver) Start() (errs []error)
Start implements the Driver interface
func (*MotorDriver) Toggle ¶
func (m *MotorDriver) Toggle() (err error)
Toggle sets the motor to the opposite of it's current state
type RelayDriver ¶
RelayDriver represents a digital relay
func NewRelayDriver ¶
func NewRelayDriver(a DigitalWriter, name string, pin string) *RelayDriver
NewRelayDriver return a new RelayDriver given a DigitalWriter, name and pin.
Adds the following API Commands:
"Toggle" - See RelayDriver.Toggle "On" - See RelayDriver.On "Off" - See RelayDriver.Off
func (*RelayDriver) Connection ¶
func (l *RelayDriver) Connection() gobot.Connection
Connection returns the RelayDrivers Connection
func (*RelayDriver) Halt ¶
func (l *RelayDriver) Halt() (errs []error)
Halt implements the Driver interface
func (*RelayDriver) Off ¶
func (l *RelayDriver) Off() (err error)
Off sets the relay to a low state.
func (*RelayDriver) Start ¶
func (l *RelayDriver) Start() (errs []error)
Start implements the Driver interface
func (*RelayDriver) State ¶
func (l *RelayDriver) State() bool
State return true if the relay is On and false if the relay is Off
func (*RelayDriver) Toggle ¶
func (l *RelayDriver) Toggle() (err error)
Toggle sets the relay to the opposite of it's current state
type ServoDriver ¶
type ServoDriver struct { gobot.Commander CurrentAngle byte // contains filtered or unexported fields }
ServoDriver Represents a Servo
func NewServoDriver ¶
func NewServoDriver(a ServoWriter, name string, pin string) *ServoDriver
NewServoDriver returns a new ServoDriver given a ServoWriter, name and pin.
Adds the following API Commands:
"Move" - See ServoDriver.Move "Min" - See ServoDriver.Min "Center" - See ServoDriver.Center "Max" - See ServoDriver.Max
func (*ServoDriver) Center ¶
func (s *ServoDriver) Center() (err error)
Center sets the servo to it's center position
func (*ServoDriver) Connection ¶
func (s *ServoDriver) Connection() gobot.Connection
Connection returns the ServoDrivers connection
func (*ServoDriver) Halt ¶
func (s *ServoDriver) Halt() (errs []error)
Halt implements the Driver interface
func (*ServoDriver) Max ¶
func (s *ServoDriver) Max() (err error)
Max sets the servo to its maximum position
func (*ServoDriver) Min ¶
func (s *ServoDriver) Min() (err error)
Min sets the servo to it's minimum position
func (*ServoDriver) Move ¶
func (s *ServoDriver) Move(angle uint8) (err error)
Move sets the servo to the specified angle. Acceptable angles are 0-180
func (*ServoDriver) Start ¶
func (s *ServoDriver) Start() (errs []error)
Start implements the Driver interface