clade / PyDAQmx

Interface to National Instrument NIDAQmx driver
Other
133 stars 55 forks source link

nameError: name 'PyDAQmx' is not defined #56

Closed Rozakos closed 5 years ago

Rozakos commented 5 years ago

Hey there, i am currently trying to execute a simple example and i am getting the above mentioned error. The card i am trying to connect to is a PCI-DIO-96, i am running windows 7/ python 3.7.3 and using Pycharm. I have also installed the NI-DAQmx driver.

I found the example code here : https://pythonhosted.org/PyDAQmx/examples/digital_output.html

Code below:

from PyDAQmx import Task import numpy as np

data = np.array([0,1,1,0,1,0,1,0], dtype=np.uint8)

task = Task() task.CreateDOChan("/TestDevice/port0/line0:7","",PyDAQmx.DAQmx_Val_ChanForAllLines) task.StartTask() task.WriteDigitalLines(1,1,10.0,PyDAQmx.DAQmx_Val_GroupByChannel,data,None,None) task.StopTask()

Error :

Traceback ( most recent call last): File "C:/pycharm/prolog.py", line 11, in task.CreateDOChan("/Dev2/port0/line0:7","",PyDAQmx,DAQmx_Val_ChanForAllLines) NameError: name 'PyDAQmx' is not defined

Any idea what could be the problem?

clade commented 5 years ago

You should import PyDAQmx with import PyDAQmx