psychos.triggers.DelayTrigger#

class psychos.triggers.DelayTrigger(port: BasePort, mapping: dict | None = None, delay: float = 0.01)[source]#

Bases: BaseTrigger

Trigger that sends a value, waits for a specified delay, then resets the port.

This trigger sends a value through the communication port, waits for a predefined delay to ensure that the value is registered, and then resets the port to a default state.

delay#

The delay in seconds after sending the trigger before resetting the port.

Type:

float

__init__(port: BasePort, mapping: dict | None = None, delay: float = 0.01)[source]#

Initialize a DelayTrigger instance.

Parameters:
  • port (BasePort) – The communication port instance used for sending triggers.

  • mapping (dict, optional) – A dictionary mapping trigger names to values.

  • delay (float, optional) – The delay in seconds to wait after sending the trigger before resetting. Defaults to 0.01.

Methods

__init__(port[, mapping, delay])

Initialize a DelayTrigger instance.

close()

Close the trigger by closing the associated communication port.

resolve_value(value)

Resolve the trigger value using the provided mapping.

send(value)

Send a trigger value, wait for a specified delay, and then reset the port.

send(value: str | int | bytes)[source]#

Send a trigger value, wait for a specified delay, and then reset the port.

Parameters:

value – The trigger value to send. This can be a string (which will be resolved using the mapping), an integer, or bytes.