Update daqmx examples to use AnalogWaveform #163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
This updates the nidaqmx examples to use the new
task.read_waveform()andtask.write_waveform()methods.I also changed how the run and stop buttons work. Trying to use
panel.get_value("run_button", False)is just not reliable, so I changed it to usepanel.get_value("is_running", False)instead, and the buttons now explicitly setis_runningwhen clicked.I also improved error handling. Now, instead of the script ending when a DAQ error happens, the script loops back to the stopped state, with a message (taking the place of the graph) saying what the error is, so that the user can change the configuration and click Run again.
I also added filters on the channel selectors so that only compatible channels are presented.
I also made some changes to improve consistency between the three daq examples.
Why should this Pull Request be merged?
AB#3353661
What testing has been done?
Ran the three examples:
examples/nidaqmx/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering.py
examples/nidaqmx/nidaqmx_analog_output_voltage/nidaqmx_analog_output_voltage.py
examples/nidaqmx/nidaqmx_continuous_analog_input/nidaqmx_continuous_analog_input.py