Package: uldaq
InfoContains a Python API for interacting with Measurement Computing’s Universal Library for Linux.AuthorMeasurement ComputingAboutTheuldaqPython package contains an API (Application Programming Interface)
for interacting with Measurement Computing DAQ devices. The package is implemented
as an object-oriented wrapper around the UL for Linux C API using thectypesPython library.uldaqsupports Python 2.7, 3.4+PrerequisitesRunning theuldaqPython API requires theUL for Linux C API.Visituldaq on GitHubto install the latest version of the UL for Linux C API.Installing theuldaqPython API requiresPythonalong with thepip,setuptoolsandwheelpackages.For more information on installing Python, go topython.org.For more information on installing Python packages with pip, see theInstalling Packagestutorial on python.org.InstallationInstall theuldaqPython API with:$ pip install uldaqNote: Installation may need to be run with sudo.ExamplesA complete set of examples is include in the source tarball.
To obtain and run the examples, follow these steps:Go topypi.org/project/uldaq.UnderNavigationclick theDownload fileslink.Click theuldaq-1.2.3.tar.gzlink to download the file.Copy the file from the default download location to a desired location.Navigate to the file location and run:$ tar -xvf uldaq-1.2.3.tar.gzThe Python examples are located in the examples folder. Run the following commands to execute the analog input example:$ cd uldaq-1.2.3/examples
$ ./a_in.pyNote: For best results, run examples in a terminal window.UsageThe following is a simple example for reading a single voltage value from each channel in
an analog input subsystem of a Measurement Computing DAQ device.fromuldaqimport(get_daq_device_inventory,DaqDevice,InterfaceType,AiInputMode,Range,AInFlag)try:# Get a list of available DAQ devicesdevices=get_daq_device_inventory(InterfaceType.USB)# Create a DaqDevice Object and connect to the devicedaq_device=DaqDevice(devices[0])daq_device.connect()# Get AiDevice and AiInfo objects for the analog input subsystemai_device=daq_device.get_ai_device()ai_info=ai_device.get_info()# Read and display voltage values for all analog input channelsforchannelinrange(ai_info.get_num_chans()):data=ai_device.a_in(channel,AiInputMode.SINGLE_ENDED,Range.BIP10VOLTS,AInFlag.DEFAULT)print('Channel',channel,'Data:',data)daq_device.disconnect()daq_device.release()exceptULExceptionase:print('\n',e)# Display any error messagesThe same example using a with block:fromuldaqimport(get_daq_device_inventory,DaqDevice,InterfaceType,AiInputMode,Range,AInFlag)try:# Get a list of available devicesdevices=get_daq_device_inventory(InterfaceType.USB)# Create a DaqDevice Object and connect to the devicewithDaqDevice(devices[0])asdaq_device:# Get AiDevice and AiInfo objects for the analog input subsystemai_device=daq_device.get_ai_device()ai_info=ai_device.get_info()# Read and display voltage values for all analog input channelsforchannelinrange(ai_info.get_num_chans()):data=ai_device.a_in(channel,AiInputMode.SINGLE_ENDED,Range.BIP10VOLTS,AInFlag.DEFAULT)print('Channel',channel,'Data:',data)exceptULExceptionase:print('\n',e)# Display any error messagesSupport/FeedbackTheuldaqpackage is supported by MCC. Foruldaqsupport, contact technical support
throughmccdaq.com/Support.aspx. Please include version information for Python,
uldaq C API and uldaq Python API packages used as well as detailed steps on how to reproduce the
problem.DocumentationDocumentation is available atmccdaq.com.Licenseuldaqis licensed under an MIT-style license. Other incorporated projects may be licensed under
different licenses. All licenses allow for non-commercial and commercial use.