Skip to main content

waitForTrigger

Wait until a trigger reaches the specified active state.

Parameter

KeyTypeDescription
idstringTrigger ID. If omitted, the trigger of printer is used.
printerstringPrinter ID. Used when id is omitted; required if more than one printer is available.
statebooleanThe active state to wait for. Required.
timeoutnumberTimeout in seconds. Required.

Return value

{position: number} with the encoder position at the moment the trigger fired, or null if the timeout elapsed before the trigger fired.

Example

waitForTrigger {"id": "trigger1", "state": true, "timeout": 5.0}