DigitalOutput
Prerequisites:
- bonsai DAQmx Library
- NI DAQmx driver from the NI website
Category: Sink
Brief: Writes a sequence of logical values to one or more DAQmx digital output channels
Input (bool)
Properties:
Channels(System.Collections.ObjectModel.Collection<Bonsai.DAQmx.DigitalOutputChannelConfiguration>) - all analog output channels that the voltage signal will be fed to, specified by adding channels in theDigitalOutputChannelConfiguration Collection Editorand setting its parameters as appropriate:ChannelName- can be anythingGrouping- specifies how to group digital output lines into virtual channels; if one or more ports are specified with theLinesparameter, this must beOneChannelForEachLine(instead ofOneChannelForAllLines)Lines- the physical digital output line on the board, selected from the drop-down list once the device is connected
Output (bool)
tip
A boolean square pulse can be generated by sampling from FunctionGenerator (BufferLength = 1) one item at a time and applying a threshold (e.g. using GreaterThan) to obtain output of type bool. This method seems to work well for SamplingRate <= 100 Hz. Note that Frequency must be less than half of the SamplingRate value in line with the Nyquist Sampling Theorem.
If higher frequency signals are needed, a combination of FunctionGenerator and AnalogOutput can be used instead (where possible).
caution
Runtime Error: Device cannot be accessed
Most likely happens because the NI-DAQmx device is not connected/powered. Several other possible reasons and remedies are listed in the bonsai error message.