Digital INTERLOCK
Description
This object is being used to form a 'Digital INTERLOCK' between multiple messages in app.
App Builder Object
Source Code
function execute() {
const signals = inPorts.length - 2;
const out = [];
if (trigger === 0) {
for (let i = 0; i < signals; i += 1) {
out.push(true);
}
} else if (trigger === 1) {
for (let i = 0; i < signals; i += 1) {
out.push(false);
}
} else {
for (let i = 0; i < signals; i += 1) {
if ((trigger - 2) === i) {
out.push(true);
} else {
out.push(false);
}
}
}
return out;
}
Truth Table
= empty / no message sent to
Set | Reset | In 1 | In 2 | In 3 | Out 1 | Out 2 | Out 3 |
---|---|---|---|---|---|---|---|
Trigger | 1 | 1 | 1 | ||||
Trigger | 0 | 0 | 0 | ||||
Trigger | 1 | 0 | 0 | ||||
Trigger | 0 | 1 | 0 | ||||
Trigger | 0 | 0 | 1 |
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Set | Trigger | This port is being used to send and hold a digital message (true) out of all three out ports. See truth table. |
2 | Reset | Trigger | This port is being used to send and hold a digital message (false) out of all three out ports. See truth table. |
3 | In 1 | Trigger | This port is being used to send and hold a digital message (true) out of Out Port 1 and set and hold any other Out Port to false. |
4 | In 2 | Trigger | This port is being used to send and hold a digital message (true) out of Out Port 2 and set and hold any other Out Port to false. |
5 | In 3 | Trigger | This port is being used to send and hold a digital message (true) out of Out Port 3 and set and hold any other Out Port to false. |
Out Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Out 1 | Digital | This port is sending out a message when the object is either triggered through In Port 1 or when In Port 3 is triggered. See truth table. |
2 | Out 2 | Digital | This port is sending out a message when the object is either triggered through In Port 1 or when In Port 4 is triggered. See truth table. |
3 | Out 3 | Digital | This port is sending out a message when the object is either triggered through In Port 1 or when In Port 5 is triggered. See truth table. |
Properties
Name | Description |
---|---|
Object Name | The name of the object on the canvas. |
Show Code View | The switch to turn on code view for the Code Object. |
Duplicate code into custom Code Object |