ENP-RL6
rl6
library implements relay management for the ENP-RL6 module.
ENP-RL6 has 6 controllable relays with IDs from 1
to 6
.
rl6.get
#
Returns the current state of single relay:
true
is closed contact,false
is opened contact,
Returns nil
when reading relay status failed, see the second return value, error code (use rl6.err_to_str
to convert it to string representation).
#
Examplerl6.open
#
Opens single relay contact.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
rl6.close
#
Closes single relay contact.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
rl6.impulse
#
Performs impulse on the single relay. The state of the relay will be changed to the opposite one for the delay
milliseconds, and then will be switched back.
Non-blocking call
This function call is non-blocking. Any other operation with the same relay ID during the impulse period will abort the impulse operation.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
#
Examplerl6.open_all
#
Opens all 6 relay contacts.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
rl6.close_all
#
Closes all 6 relay contacts.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
rl6.set_all
#
Simultaneously change states of all relays. true
will close the corresponding relay, false
will open it.
Returns 0
on success, otherwise returns error code (use rl6.err_to_str
to convert it to string representation).
#
Examplerl6.err_to_str
#
Returns string representation of rl6
function return code.
Error on relay operation usually means hardware problem, contact Enapter support at support@enapter.com to address the issue.