Normally Mendix is running on a server, but if you run Mendix on a computer that is connected with the USB relay you need a java-action and this library
import net.symbioquine.usbhidrelay.UsbHidRelay;
import static net.symbioquine.usbhidrelay.UsbHidRelaySize.SIXTEEN;
UsbHidRelay relay = UsbHidRelay.findAndAcquireFirstRelay(SIXTEEN);
relay.setSwitchOn(0);