Description
This object is a digital to analog converter and is being used to map a given time (in ms) into a block of 4096 and count up.
App Builder Object
Source Code
function execute() { switch (trigger) { case TRIGGERS.SYSTEM_ASYNC: { if (context.counter < 4096 && context.state) { context.counter += context.segment; if (context.counter > 4095) { return [4095]; } sleep(100, true); return [context.counter]; } break; } case 0: { cancelSleep(); context.totalTime = inPorts[1].value; context.splitTime = context.totalTime / 100; context.segment = 4096 / context.splitTime; context.counter = 0; context.state = true; sleep(100, true); return [context.counter]; } case 2: // reset { context.state = false; cancelSleep(); context.counter = 0; return [context.counter]; } default: break; } return []; }
Examples
Example | Initialize | Time (ms) | Step width (s) |
---|---|---|---|
1 | Trigger | 4096 | 1 for 4095 |
2 | Trigger | 8192 | 0.5 for 4095 |
3 | Trigger | 5000 | 0.8192 for 4095 |
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Start | Trigger | This port is being used to start the 'Ramp Up' object. |
2 | Time (Ms) | Number | This port is being used to receive a time for the 'Ramp Up' object. |
3 | Reset | Trigger | This port is being used to reset the 'Ramp Up' object. |
Out Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Out | Analog | This port releases the counting up from the given time in a block of 4096 steps. |
Properties
Name | Description |
---|---|
Object Name | The name on 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 |