{"library":"nidaqmx","title":"NI-DAQmx Python API","description":"The `nidaqmx` package provides a Python API for interacting with the NI-DAQmx driver, enabling development of instrumentation, acquisition, and control applications with NI data acquisition (DAQ) devices. It acts as a highly object-oriented wrapper around the NI-DAQmx C API. The library is actively maintained with frequent releases, with the current stable version being 1.4.1.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install nidaqmx"],"cli":null},"imports":["import nidaqmx","from nidaqmx import Task","from nidaqmx import constants"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import nidaqmx\nimport os\n\n# Replace 'Dev1/ai0' with the actual physical channel name of your DAQ device.\n# You can find device names in NI MAX. For demonstration, we use an env var.\n# For a simulated device, you might use 'SimulatedDAQ/ai0' after configuring it in NI MAX.\nPHYSICAL_CHANNEL = os.environ.get('NIDAQMX_DEV_CHANNEL', 'Dev1/ai0')\n\ntry:\n    with nidaqmx.Task() as task:\n        task.ai_channels.add_ai_voltage_chan(PHYSICAL_CHANNEL)\n        print(f'Reading voltage from {PHYSICAL_CHANNEL}...')\n        data = task.read()\n        print(f'Acquired data: {data} V')\nexcept nidaqmx.errors.DaqError as e:\n    print(f\"NI-DAQmx Error: {e}\")\n    print(\"Please ensure your NI-DAQmx driver is installed and your device/channel name is correct in NI MAX.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to perform a single-point analog voltage acquisition. It initializes a DAQmx task, adds an analog input voltage channel, and reads a single sample. Replace 'Dev1/ai0' with the actual physical channel name of your NI DAQ device, which can be found and configured in NI MAX. Ensure the NI-DAQmx driver is installed before running.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}