04-11-2023, 10:48 AM
Hi,
I'm trying to convert a selector switch to multiple Modbus outputs.
I can see that the javascript seems to work when I compile, however, the data is not sent to the Modbus Logo.
This is my code.
The outputs themselves do work towards the Modbus Logo.
see also attached screenshot.
I'm trying to convert a selector switch to multiple Modbus outputs.
I can see that the javascript seems to work when I compile, however, the data is not sent to the Modbus Logo.
This is my code.
The outputs themselves do work towards the Modbus Logo.
see also attached screenshot.
Code:
//--- Copy values from Virtuino Variables to JavaScript variables
var BranderModus = Virtuino.readValue("InputTag"); //Read inputTag value as String.
if (BranderModus == 1) {
Branderuit = '{"tag":"OutputTag1", "value":1}';
Branderaan = '{"tag":"OutputTag2", "value":0}';
} else if (BranderModus == 2) {
Branderuit = '{"tag":"OutputTag1", "value":0}';
Branderaan = '{"tag":"OutputTag2", "value":0}';
} else if (BranderModus == 3) {
Branderuit = '{"tag":"OutputTag1", "value":0}';
Branderaan = '{"tag":"OutputTag2", "value":1}';
} else {
result = null; // return null if you don't want to send a value to output variable
}
result = [Branderuit, Branderaan];