Relay

A relay is a circuit operated by an electric current that can be used to remotely switch another circuit. Since it can accept the two values on and off of a switch and requires an action from the control circuit as input, it is a digital actuator.

Further information to the actuator you will find here.
Relay can be ordered here.

port: A1
interface: digital
input values

1/0, on/off

Makecode

An action/condition can be selected to turn the relay on or off. In the example in the HEX file, the two key events for A and B are used to close the circuit. The write digital value of pin x to 0 block can be found under the advanced pin blocks. The pin must be set to C16 of the A1 connector.


hex

Open Roberta Lab

In the robot configuration, a digital actuator must be configured first. In this case the pin C16 of the A1 connector.
Back in the program editor, under the advanced blocks action > pin, one finds the block write digital value to pin x. Now an action/condition can be selected for an if/then branch to switch the state for the relay to on or off. In the example in the XML file, buttons A and B are used. For example, if button A is pressed, then the other circuit is to be closed, so the value for pin C16 of the relay is set to 1.


xml