RelayHardware UCMVirtual UCM
The relay library provides an interface for controlling relays. This is high level API for controlling digital outputs with human-friendly naming.
The relay library is available for:
- ENP-RL6, using 6 hardware ports,
- ENP-RL6 M2, using 6 hardware ports,
- Virtual UCM on Welotec Arrakis Mk3/Mk4 with DIO module installed, using 4 hardware ports,
- Virtual UCM on any PC using Generic IO interface.
relay.new
-- @param connection_string string Connection URI
-- @return object|nil, string|nil
function relay.new(connection_uri)
end
Returns a new relay client. The connection URI should specify the desired relay (digital output) device.
Use port schema to access hardware ports. On Virtual UCM you may also use gio schema for Generic IO.
On failure, it returns nil and an error message string.
client Object
client:close
-- @return string|nil
function client:close()
end
Closes the relay contact.
On success, the function returns nil. On failure, it returns an error message string.
client:open
-- @return string|nil
function client:open()
end
Opens the relay contact.
On success, the function returns nil. On failure, it returns an error message string.
client:impulse
-- @param duration number Impulse duration in milliseconds
-- @return string|nil
function relay:impulse(duration)
end
Triggers a relay impulse for a specified duration. This function is non-blocking, meaning it returns immediately, before the impulse ends.
On success, the function returns nil. On failure, it returns an error message string.
client:is_closed
-- @return boolean, string|nil
function relay:is_closed()
end
Checks if the relay is closed. Returns true if relay is closed, false if relay is open.
On failure, it returns false and an error message string.