フィルターのクリア

How to acquire data through Analog Input and use in a Digital Output with NI myDAQ?

3 ビュー (過去 30 日間)
Danté Davids
Danté Davids 2017 年 9 月 5 日
回答済み: Amit Doshi 2017 年 9 月 7 日
I'm using a DAQ to acquire data through an Analog Port (AI:0) and need to use it to control 2 Digital Ports (D0:4;5 & D0:6;7). Using inputsingleScan I can only acquire 1 single scan from the Analog Input. I need to constantly update this scan in order to control the Digital Output. startForeground and startBackground seem to only work with Analog inputs and outputs.
I am taking data from a Photo-transistor and using it to change the direction of 2 motors.
So my question is, how can I continuously take scans using the Analog input to update the operations on the Digital Output?

回答 (1 件)

Amit Doshi
Amit Doshi 2017 年 9 月 7 日
Hello Danté,
You could use 'addlistener' to add a listener function to the session. This function is called every time the DataAvailable event occurs. Refer the below link :
Inside that function, you can loop through the acquired data and use the 'outputSingleScan' function to output the data to a digital channel. Refer the below link:

カテゴリ

Help Center および File ExchangeData Acquisition Toolbox Supported Hardware についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by