Giter VIP home page Giter VIP logo

netdaqmx's Introduction

UPDATE!

The NetDAQmx repository has moved! It now lives here:

https://github.com/BenMendel/NetDAQmx

NetDAQmx

This project provides a minimalistic C# wrapper around the NI-DAQmx driver.

Example

using NetDAQmx;

internal class Program
{
	/// <summary>
	/// This code was tested on these devices: NI-9481, NI-9485.
	/// </summary>
	static void Main(string[] args)
	{
		int relay = 1;                // 0,1,2, or 3 for NI-9481.  0,1,2,3,4,5,6, or 7 for NI-9485.
		bool close = true;            // Set this to false to open the relay.
		string device_name = "Dev1";  // Use NI-MAX to assign this name.

		// Open or close the relay.
		Daq.actuate_relay(device_name, close, relay);

		// Read whether it is open or closed.
		bool is_closed = Daq.is_relay_closed(device_name, relay);

		// Print the results.
		Console.WriteLine(is_closed ? "Closed" : "Open" );
	}
}

Tips for Further Development

  • The NI-DAQmx dll is actually named nicaiu.dll.
  • The NIDAQmx.h file defines all the function signatures for NI-DAQ.
  • I would have included it in this project except that it is copyright by National Instruments.
  • You can find NIDAQmx.h in either of the following directories:
    • C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\include
    • C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include
  • The fastest way to implement more functions is to copy them to ChatGPT and ask it to write the C# P/Invoke functions.
  • Fun Fact: The Python library pydaqmx actually finds this file on your computer and dynamically builds all the functions from it.

netdaqmx's People

Contributors

jrdnwrth avatar

Stargazers

 avatar Ben Mendel avatar  avatar  avatar  avatar

Watchers

 avatar  avatar Ben Mendel avatar

Forkers

benmendel

netdaqmx's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.