I wrote a scripts to read a sensor value from NIDAQ , in pycharm it works.
But in Script Console , there is an error.
message = f'{message}\n\nTask Name: {task_name}'
^
SyntaxError: no viable alternative at input ''{message}\n\nTask Name: {task_name}''
Ts = 1 # Sampling Time
N = 5
for k in range(N):
value = task.read()
air = (value-0.004)/0.016*147
print("Air Flow =", round(value,3), "CFM")
time.sleep(Ts)
The file "task.py" is in the "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib ".
The following is from NI website:
The nidaqmx package contains the Application Programming Interface (API) for interacting with the NI-DAQmx driver and it is supported on Windows using CPython 2.7, 3.4+, PyPy2, and PyPy3.
Not directly no. You can always shell out to it if you have CPython on the computer in general and using system.util.execute or ProcessBuilder. You can find examples throughout the forum like here Subprocess & system.util.execute
Hey, did the solution with system.util.execute work for you? Iām facing a similar issue where I need to read sensors data from NI-DAQmx and would appreciate any insights or updates you have on how it worked for you!