Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Source Code

Code Block
languagejs
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

...