node-DAQmx enables Remote Procedure Calls (RPCs) from a node.js server to DAQmx driver functions. Using WebSockets, this is extended further to client-side javascript.
This project uses node-ffi to expose the driver functions to the node.js server. Then, the client uses WebSockets to connect to the server and make calls to the exposed functions.
- Make sure you have DAQmx drivers on the computer you plan to run the node server on
- Also make sure you have DAQmx hardware plugged into theat same computer, or a simulated channel using NI MAX
- Install node.js https://nodejs.org/
- In the top directory, do an npm install to get the packages installed
- Run node ffi-app.js
- Go to localhost:3000
- Select a channel from the dropdown menu
- Adjust the sample rate, max voltage, and min voltage
- Click setup for collection, then click run
- At the moment, you will have to restart the node app and refresh the page to select a different channel or change any settings
- Click set up for digital I/O
- Click read to read in the state of the digital port on the DAQ device
- Click some of the checkbox buttons to change them, then click write to write those values to the DAQ device
- Establish a standard WebSocket connection
- To call the functions from the client, you must send a json message with the correct data. Examples of messages that could be sent are available in the jsonMessageExamples.txt file