I am having trouble reading signals and also doing a write task. I get this error:
nidaqmx.errors.DaqError: The specified resource is reserved. The operation could not be completed as specified. i am using a USB 6001, and do not need very fast sampling rates, I just want to take the data and send out a voltage output.
Task Name: _unnamedTask<4B4>
Status Code: -50103
Here is my code:
with nidaqmx.Task() as writeTask, nidaqmx.Task() as readTask:
readTask.ai_channels.add_ai_voltage_chan(self.deviceName,
terminal_config = nidaqmx.constants.TerminalConfiguration.RSE)
readTask.ai_rng_high = 10.0
readTask.timing.cfg_samp_clk_timing(rate = 10,
sample_mode = nidaqmx.constants.AcquisitionType.FINITE,
samps_per_chan = 10)
data = readTask.read(number_of_samples_per_channel=10)
writeTask.ao_channels.add_ao_voltage_chan("Dev3/ao0")
writeTask.timing.cfg_samp_clk_timing(rate = 10,
sample_mode = nidaqmx.constants.AcquisitionType.FINITE,
samps_per_chan = 2)
writer = AnalogMultiChannelWriter(writeTask.out_stream)
writer.write_many_sample(np.array([[2.0]]))