API Reference v9.2.0

DeviceIOclass

Module: ZaberMotionAscii

Class providing access to the I/O channels of the device.

The following example illustrates how you can obtain an instance of this type:

import ZaberMotionAscii

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let deviceIO = device.io
Related Guides:

Methods

m

cancelAllAnalogOutputsSchedule()

asyncthrows
try await deviceIO.cancelAllAnalogOutputsSchedule(channels = [])
Cancel all scheduled analog output actions. Requires at least Firmware 7.38.
Arguments
NameTypeDescription
channels[Bool]Optionally specify which channels to cancel. Array length must be empty or equal to the number of channels on device. Specifying "True" for a channel will cancel the scheduled analog output value for that channel.
m

cancelAllDigitalOutputsSchedule()

asyncthrows
try await deviceIO.cancelAllDigitalOutputsSchedule(channels = [])
Cancel all scheduled digital output actions. Requires at least Firmware 7.37.
Arguments
NameTypeDescription
channels[Bool]Optionally specify which channels to cancel. Array length must be empty or equal to the number of channels on device. Specifying "True" for a channel will cancel the scheduled digital output action for that channel.
m

cancelAnalogOutputSchedule()

asyncthrows
try await deviceIO.cancelAnalogOutputSchedule(channelNumber)
Cancels a scheduled analog output value. Requires at least Firmware 7.38.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
m

cancelDigitalOutputSchedule()

asyncthrows
try await deviceIO.cancelDigitalOutputSchedule(channelNumber)
Cancels a scheduled digital output action. Requires at least Firmware 7.37.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
m

getAllAnalogInputs()

asyncthrows
try await deviceIO.getAllAnalogInputs()
Returns the current values of all analog input channels.
Return Value
[Double] Measurements of the voltages present on the input channels.
m

getAllAnalogOutputs()

asyncthrows
try await deviceIO.getAllAnalogOutputs()
Returns the current values of all analog output channels.
Return Value
[Double] Measurements of voltage that the output channels are conducting.
m

getAllDigitalInputs()

asyncthrows
try await deviceIO.getAllDigitalInputs()
Returns the current values of all digital input channels.
Return Value
[Bool] True if voltage is present on the input channel and false otherwise.
m

getAllDigitalOutputs()

asyncthrows
try await deviceIO.getAllDigitalOutputs()
Returns the current values of all digital output channels.
Return Value
[Bool] True if the output channel is conducting and false otherwise.
m

getAllLabels()

asyncthrows
try await deviceIO.getAllLabels()
Returns every label assigned to an IO port on this device.
Return Value
[IoPortLabel] The labels set for this device's IO.
m

getAnalogInput()

asyncthrows
try await deviceIO.getAnalogInput(channelNumber)
Returns the current value of the specified analog input channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
Return Value
Double  A measurement of the voltage present on the input channel.
m

getAnalogOutput()

asyncthrows
try await deviceIO.getAnalogOutput(channelNumber)
Returns the current values of the specified analog output channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
Return Value
Double A measurement of voltage that the output channel is conducting.
m

getChannelsInfo()

asyncthrows
try await deviceIO.getChannelsInfo()
Returns the number of I/O channels the device has.
Return Value
DeviceIOInfo An object containing the number of I/O channels the device has.
m

getDigitalInput()

asyncthrows
try await deviceIO.getDigitalInput(channelNumber)
Returns the current value of the specified digital input channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
Return Value
Bool True if voltage is present on the input channel and false otherwise.
m

getDigitalOutput()

asyncthrows
try await deviceIO.getDigitalOutput(channelNumber)
Returns the current value of the specified digital output channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
Return Value
Bool True if the output channel is conducting and false otherwise.
m

getLabel()

asyncthrows
try await deviceIO.getLabel(portType, channelNumber)
Returns the label of the specified channel.
Arguments
NameTypeDescription
portTypeIoPortTypeThe type of channel to get the label of.
channelNumberIntChannel number starting at 1.
Return Value
String The label of the specified channel.
m

setAllAnalogOutputs()

asyncthrows
try await deviceIO.setAllAnalogOutputs(values)
Sets values for all analog output channels.
Arguments
NameTypeDescription
values[Double]Voltage values to set the output channels to.
m

setAllAnalogOutputsSchedule()

asyncthrows
try await deviceIO.setAllAnalogOutputsSchedule(values, futureValues, delay, unit = Units.native)
Sets current and future values for all analog output channels. Requires at least Firmware 7.38.
Arguments
NameTypeDescription
values[Double]Voltage values to set the output channels to immediately.
futureValues[Double]Voltage values to set the output channels to in the future.
delayDoubleDelay between setting current values and setting future values.
unitUnitsUnits of time.
m

setAllDigitalOutputs()

asyncthrows
try await deviceIO.setAllDigitalOutputs(values)
Sets values for all digital output channels.
Arguments
NameTypeDescription
values[DigitalOutputAction]The type of action to perform on the channel.
m

setAllDigitalOutputsSchedule()

asyncthrows
try await deviceIO.setAllDigitalOutputsSchedule(values, futureValues, delay, unit = Units.native)
Sets current and future values for all digital output channels. Requires at least Firmware 7.37.
Arguments
NameTypeDescription
values[DigitalOutputAction]The type of actions to perform immediately on output channels.
futureValues[DigitalOutputAction]The type of actions to perform in the future on output channels.
delayDoubleDelay between setting current values and setting future values.
unitUnitsUnits of time.
m

setAnalogInputLowpassFilter()

asyncthrows
try await deviceIO.setAnalogInputLowpassFilter(channelNumber, cutoffFrequency, unit = Units.native)
Sets the cutoff frequency of the low-pass filter for the specified analog input channel. Set the frequency to 0 to disable the filter.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
cutoffFrequencyDoubleCutoff frequency of the low-pass filter.
unitUnitsUnits of frequency.
m

setAnalogOutput()

asyncthrows
try await deviceIO.setAnalogOutput(channelNumber, value)
Sets value for the specified analog output channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
valueDoubleValue to set the output channel voltage to.
m

setAnalogOutputSchedule()

asyncthrows
try await deviceIO.setAnalogOutputSchedule(channelNumber, value, futureValue, delay, unit = Units.native)
Sets current and future value for the specified analog output channel. Requires at least Firmware 7.38.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
valueDoubleValue to set the output channel voltage to immediately.
futureValueDoubleValue to set the output channel voltage to in the future.
delayDoubleDelay between setting current value and setting future value.
unitUnitsUnits of time.
m

setDigitalOutput()

asyncthrows
try await deviceIO.setDigitalOutput(channelNumber, value)
Sets value for the specified digital output channel.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
valueDigitalOutputActionThe type of action to perform on the channel.
m

setDigitalOutputSchedule()

asyncthrows
try await deviceIO.setDigitalOutputSchedule(channelNumber, value, futureValue, delay, unit = Units.native)
Sets current and future value for the specified digital output channel. Requires at least Firmware 7.37.
Arguments
NameTypeDescription
channelNumberIntChannel number starting at 1.
valueDigitalOutputActionThe type of action to perform immediately on the channel.
futureValueDigitalOutputActionThe type of action to perform in the future on the channel.
delayDoubleDelay between setting current value and setting future value.
unitUnitsUnits of time.
m

setLabel()

asyncthrows
try await deviceIO.setLabel(portType, channelNumber, label)
Sets the label of the specified channel.
Arguments
NameTypeDescription
portTypeIoPortTypeThe type of channel to set the label of.
channelNumberIntChannel number starting at 1.
labelString?The label to set for the specified channel. If no value or an empty string is provided, this label is deleted.