...
Code Block | ||
---|---|---|
| ||
function execute() { let total = 0; switch (trigger) { case 0: if (inPorts[1].value === true) { total += 1; } if (inPorts[2].value === true) { total += 2; } if (inPorts[3].value === true) { total += 4; } if (inPorts[4].value === true) { total += 8; } if (inPorts[5].value === true) { total += 16; } if (inPorts[6].value === true) { total += 32; } if (inPorts[7].value === true) { total += 64; } if (inPorts[8].value === true) { total += 128; } if (inPorts[9].value === true) { total += 256; } return [total]; default: break; } return []; } |
...
Examples
Example | Initialize | Digital Input | Number |
---|---|---|---|
1 | Trigger | 1 on, 4 on, 16 on | 21 |
2 | Trigger | 4 on, 64 on | 68 |
3 | Trigger | 2 on, 4 on, 8 on, 32 on | 46 |
...
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Trigger | Trigger | This port is being used to trigger the 'Binary to Number' object. |
2 | 1 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
3 | 2 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
4 | 4 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
5 | 8 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
6 | 16 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
7 | 32 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
8 | 64 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
9 | 128 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
10 | 256 | Digital | This port is being used to set the digital state of the ‘Binary to Number’ Object. |
...
Out Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Value | Number | This port is being used to release the number of the ‘Binary to Number’ Object. |
...
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 |