I am thinking of purchasing the same device for an application of my company. Can somebody verify that the code works/works as supposed?
Here are some useful link that can work for you in the future about
This GitHub page is awesome, a lot of examples https://github.com/ni/nidaqmx-python
Here is an official white paper http://www.ni.com/white-paper/53059/en/ about NI and Python Resources
Here is a really good pdf https://media.readthedocs.org/pdf/nidaqmx-python/latest/nidaqmx-python.pdf
have a great day.
I tried to run the script given but I get the following error:
sensor = NiUsbTC01()
File "nitc.py", line 33, in __init__
self.nidaq = ctypes.WinDLL(nidaq_dll_path)
File "C:\Python35-32\lib\ctypes\__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The reason is that I don't have the nicau.dll. How can I get it to run without installing all the nidaqmx runtime?
Unfortunately, you'll indeed need it. Use the commented-out line:
self.nidaq = ctypes.windll.nicaiu
My code from above is incorrect for that matter, since using only the one DLL doesnt work, which I hadnt realized before I tested it on another machine where the runtime wasnt installed.
I also tried to walk down all the dependencies, hoping it'll be just a couple of DLLs that I'd have to add and that it would be portable, but no luck, I finally gave up. But let me know if you can come up with something, it's quite annyoing that you have to install a whopping 300MB software bundle to be able to read out a simple temperature sensor...
In order to run the python script you have to include the absolute file path of nicau.dll (mine is "C:/Windows/SysWOW64/nicaiu.dll").
I attach the code.