Documentation
¶
Index ¶
- type PulseActuator
- func (pa *PulseActuator) Configure() error
- func (pa *PulseActuator) InPowerSafeMode() bool
- func (pa *PulseActuator) IsOn() bool
- func (pa *PulseActuator) IsReady() bool
- func (pa *PulseActuator) Set(on bool) error
- func (pa *PulseActuator) SetOff() error
- func (pa *PulseActuator) SetOn() error
- func (pa *PulseActuator) SetPowerSafeMode(on bool) (bool, error)
- func (pa *PulseActuator) Toggle() error
- func (pa *PulseActuator) WasChanged() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PulseActuator ¶
type PulseActuator struct {
// contains filtered or unexported fields
}
PulseActuator is a binary driver (on/off) for pulse based actuators like impulse valves or impulse switches. Each state is reached by setting one of 2 outputs for a short time only. If the hardware supports only one pin, the right one can be chosen regarding normal or inverted state. This driver is originally designed to work with tinygo-devices (MCU) but should also work with gobot CPU's.
func New ¶
func New(pinOn, pinOff outputPinner, defaultState bool) *PulseActuator
New creates a new object for pulse actuator
func (*PulseActuator) Configure ¶
func (pa *PulseActuator) Configure() error
Configure configures the pins and the initiate the default state
func (*PulseActuator) InPowerSafeMode ¶
func (pa *PulseActuator) InPowerSafeMode() bool
InPowerSafeMode returns whether the actuator is in power safe mode and do not accept state changes.
func (*PulseActuator) IsOn ¶
func (pa *PulseActuator) IsOn() bool
IsOn returns whether the actuator is in on state.
func (*PulseActuator) IsReady ¶
func (pa *PulseActuator) IsReady() bool
IsReady returns whether the actuator is ready for the next change of state, means the charge time is over.
func (*PulseActuator) Set ¶
func (pa *PulseActuator) Set(on bool) error
Set sets the actuator to the desired state
func (*PulseActuator) SetOff ¶
func (pa *PulseActuator) SetOff() error
SetOff sets the actuator to off state
func (*PulseActuator) SetOn ¶
func (pa *PulseActuator) SetOn() error
SetOn sets the actuator to on state
func (*PulseActuator) SetPowerSafeMode ¶
func (pa *PulseActuator) SetPowerSafeMode(on bool) (bool, error)
SetPowerSafeMode if "true" is given, brings the actuator in the default state and blocks all subsequent calls to change the state by other than this function. If "false" is given, releases all blocks and set the state of the actuator to the one before the function was called with a "true". Returns whether the state was changed to "true".
func (*PulseActuator) Toggle ¶
func (pa *PulseActuator) Toggle() error
Toggle sets the actuator to the opposite state
func (*PulseActuator) WasChanged ¶
func (pa *PulseActuator) WasChanged() bool
WasChanged returns whether the state was really changed from the last change command.