- To open the first relay:
relay set 0 1
. - To close the first relay:
relay set 0 0
. - To create a cycle on the first relay:
relay repeat 0 COUNT PERIOD
- Since there is no physical device to test relay on SITL, there is a special parameter called
SIM_PIN_MASK
. - Each bit of this parameter contains logical input/output state for individual channels (in SITL, these channels are different than servo outputs).
- Before doing relay operations, make sure to set
RELAY_PINx
(up to 6) to an appropriate value. - For example,
RELAY_PIN = 0
means that:- Changing the value of first relay instance will change the 0th bit of the
SIM_PIN_MASK
. relay set 0 1
will result toSIM_PIN_MASK = 1
.relay set 0 0
will result toSIM_PIN_MASK = 0
.
- Changing the value of first relay instance will change the 0th bit of the
- In real world applications, you need to set
RELAY_PINx
to an appropriate value as stated in the documentation.