def write_one_sample_one_line(self, data, timeout=10):
"""
Writes a single boolean sample to a single digital output
channel in a task. The channel can contain only one digital
line.
Args:
data (int): Specifies the boolean sample to write to the
task.
timeout (Optional[float]): Specifies the amount of time in
seconds to wait for the method to write all samples.
NI-DAQmx performs a timeout check only if the method
must wait before it writes data. This method returns an
error if the time elapses. The default timeout is 10
seconds. If you set timeout to
nidaqmx.constants.WAIT_INFINITELY, the method waits
indefinitely. If you set timeout to 0, the method tries
once to write the submitted samples. If the method could
not write all the submitted samples, it returns an error
and the number of samples successfully written.
"""
auto_start = (self._auto_start if self._auto_start is not
AUTO_START_UNSET else True)
numpy_array = numpy.asarray([data], dtype=numpy.bool)
return _write_digital_lines(
self._handle, numpy_array, 1, auto_start, timeout)
评论列表
文章目录