TASK_WAIT_UNTIL_DONE
Waits for the measurement or generation to complete. Use this method to ensure that the specified operation is complete before you stop the task.
**Compatibility:**
Compatible with National Instruments devices that utilize NI-DAQmx.
This block is designed for use with Windows and Linux systems due to NI driver availability. Ensure you have installed the NI-DAQmx runtime from https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html. Params: task_name : str The name of the task to wait for. timeout : float Specifies the maximum amount of time in seconds to wait for the measurement or generation to complete. This method returns an error if the time elapses. Returns: out : Optional[DataContainer] Return the input
Python Code
from flojoy import flojoy, DataContainer, DeviceConnectionManager
from typing import Optional
@flojoy(deps={"nidaqmx": "0.9.0"})
def TASK_WAIT_UNTIL_DONE(
task_name: str,
timeout: float = 10.0,
default: Optional[DataContainer] = None,
) -> Optional[DataContainer]:
"""Waits for the measurement or generation to complete.
Use this method to ensure that the specified operation is complete before you stop the task.
**Compatibility:**
Compatible with National Instruments devices that utilize NI-DAQmx.
This block is designed for use with Windows and Linux systems due to NI driver availability. Ensure you have installed the NI-DAQmx runtime from https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html.
Parameters
----------
task_name: str
The name of the task to wait for.
timeout : float
Specifies the maximum amount of time in seconds to wait for the measurement or generation to complete. This method returns an error if the time elapses.
Returns
-------
Optional[DataContainer]
Return the input
"""
task = DeviceConnectionManager.get_connection(task_name).get_handle()
task.wait_until_done(timeout=timeout)
return default
Example
Having problems with this example app? Join our Discord community and we will help you out!
This app shows how to use a thermocouple and voltage input blocks for with National Instruments Compact DAQ modules.
Blocks used:
CREATE_TASK_ANALOG_INPUT_THERMOCOUPLE
CREATE_TASK_ANALOG_INPUT_VOLTAGE
CONFIG_TASK_SAMPLE_CLOCK_TIMINGS
TASK_WAIT_UNTIL_DONE
- 2x
READ_TASK
- 2x
LINE
The blocks were connected as shown, and the app was run. The result displayed the first 100 samples taken from the two devices’ buffer for multiple channels. The app ensures that the operation is complete for the thermocouple task before stopping it.