Number to Binary

Description

This object is being used to turn a number into a binary.


App Builder Object


Source Code

 

function execute() { const retArray = []; switch (trigger) { case 0: { const int = inPorts[1].value; for (let i = 0; i < 10; i++){ retArray.push(Boolean(int & (0x01 << i))); } return retArray; } default: break; } return []; }

Examples

Example

Initialize

Number

Digital Output

Example

Initialize

Number

Digital Output

1

Trigger

29

16 on, 8 on, 4 on, 1 on

→ 11101

2

Trigger

7

4 on, 2 on, 1 on

→ 111

3

Trigger

125

64 on, 32 on, 16 on,

8 on, 4 on, 1 on

→ 1111101


In Ports

Position

Name

Message Type

Description

Position

Name

Message Type

Description

1

Trigger

Trigger

This port is being used to trigger the 'Number to Binary' object.

2

Number

Number

This port is being used to receive the number for the ‘Number to Binary’.


Out Ports

Position

Name

Message Type

Description

Position

Name

Message Type

Description

1

1

Digital

This port is being used to release a digital message from the conversion.

2

2

Digital

This port is being used to release a digital message from the conversion.

3

4

Digital

This port is being used to release a digital message from the conversion.

4

8

Digital

This port is being used to release a digital message from the conversion.

5

16

Digital

This port is being used to release a digital message from the conversion.

6

32

Digital

This port is being used to release a digital message from the conversion.

7

64

Digital

This port is being used to release a digital message from the conversion.

8

128

Digital

This port is being used to release a digital message from the conversion.

9

256

Digital

This port is being used to release a digital message from the conversion.


Properties

Name

Description

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