How to pause execution of push button until specific trigger received by NI device?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a user interface (GUIDE) in which the user is supposed to press a push button to initiate analog output to NI devices:
NIao = daq.createSession('ni');
addAnalogOutputChannel(NIao, 'Dev1', ['ao', handles.laser.port], 'Voltage');
NIao.Rate = 1000;
warning('off', 'all')
In my setting, I need the user to press the push button and then I need the program to wait with the execution until it receives an input trigger from the NI device. I thought I could use startForeground(s) for the input from the NI device:
NIai=daq.createSession('ni');
addAnalogInputChannel(NIai,'Dev1',1,'Voltage');
NIai.Rate = 1000;
startForeground(NIai)
which would then block the following code, that is, the output, from being executed:
queueOutputData(NIao, handles.laser.laserAna);
NIao.startBackground();
However, I am not sure how to define the session operation as "complete" since I need it to wait for a certain input (trigger) from the NI device, that is, a reduction in voltage to ~ 0 V. But perhaps waitfor would also be a work around?
Thank you in advance.
3 Kommentare
Walter Roberson
am 11 Jun. 2017
Could you post your adjusted code, as an example for others? (It would make sense to post it as an Answer to your own Question)
Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!