Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

cDAQ and Python

We have a client who is running a cDAQ with a few cards to read/write analog voltages. That's it. Their current LabView system is so convoluted and disorganized, that we couldn't even figure out what it was supposed to be doing. The client has asked if it is possible to move this to Python for better future-proofing. 


I attempted to install nidaqmx via pip3, but even when we have plugged in the NI cDAQ, it gives all sorts of errors and says none of the functions work or a NI cDAQ cannot be found. I'm not a CS person by training (I have a controls background) so the code/IDE setup is all very new to me, so please forgive me if I seem naive--I am. 


Any help is appreciated. I'm not deep into this project so starting over isn't a painful option if this is the wrong path forward. 


Let me know if you need any further information. Thank you in advance. 



I've attached the code I was attempting below:


import nidaqmx


with nidaqmx.Task() as task:

with nidaqmx.Task() as task:

0 Kudos
Message 1 of 2

Are you working in Windows? If you are, is the cDAQ called Dev1 in NI MAX? My cDAQ chassis and modules are called something like cDAQ1Mod1, by default.


Second, if you want to see the output of the functions, wrap them with a print statement as below:




Also, some of the Python examples that NI has in their Python documentation are not 100% correct (nidmm comes to mind). What you have looks to be correct (I can't verify at the moment because I'm not at my bench) as long as the device name and channel are correct.

0 Kudos
Message 2 of 2