The Python API for Linux allows users to access and control supported Measurement Computing hardware using the Python language over the Linux platform. Python 2.7 and 3.4+ are supported.
The Python package name is uldaq. The uldaq package is implemented in Python as an interface to the UL shared object library.
The UL for Linux API provides structures and enumerations to manage connected devices, obtain information about device capabilities, and configure hardware settings.
For performance reasons, data is returned in the Python API as arrays instead of lists.
The uldaq package is available on GitHub.
Refer to the README file for information about how to download the UL for Linux package and install the API.
Creating a Python program¶
When creating a UL for Linux program in Python, import the uldaq package to use in your
Refer to the example programs and the API documentation in the Python API Reference for more information.
UL for Linux example programs are available to run with MCC hardware. Refer to the README file for information about how to download and extract the examples.
Connect a supported Measurement Computing DAQ device to your system before running an example. Complete these steps to run a UL for Linux example:
Open a terminal window in the UL for Linux examples folder directory.
Enter ./file_name.py. For example, enter ./a_in.py to run the analog input example.
Users can also choose to import the example code into an IDE, such as PyCharm or Eclipse, and run the examples from that environment.
The example download file includes the following example programs:
Reads an A/D input channel. Demonstrates
Performs an A/D scan using events to determine the data in an array. Demonstrates when data is available or when the acquisition is complete. The example also demonstrates how to retrieve the data when it becomes available. Demonstrates
Writes a specified value to a D/A output channel. Demonstrates
Discovers remote Ethernet DAQ devices. Demonstrates
Reads a temperature channel. Demonstrates
Refer to the Hardware Reference section for a list of all supported Measurement Computing devices with links to supported UL for Linux capabilities.