# API Reference v10.3.1 (Python)

## DeviceIO (class)

Module: zaber_motion.ascii

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

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

```py
from zaber_motion.ascii import Connection

connection = Connection.open_serial_port("COM3")
device = connection.get_device(1)
device_io = device.io
```

Related Guides:

- [Device I/O](https://software.zaber.com/motion-library/docs/guides/device_features/device_io.md)

### Methods

#### `cancel_all_analog_outputs_schedule()` (async available)

`device_io.cancel_all_analog_outputs_schedule(channels = [])`

Cancel all scheduled analog output actions.

Requires at least Firmware 7.38.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channels` | `List[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. |

#### `cancel_all_digital_outputs_schedule()` (async available)

`device_io.cancel_all_digital_outputs_schedule(channels = [])`

Cancel all scheduled digital output actions.

Requires at least Firmware 7.37.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channels` | `List[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. |

#### `cancel_analog_output_schedule()` (async available)

`device_io.cancel_analog_output_schedule(channel_number)`

Cancels a scheduled analog output value.

Requires at least Firmware 7.38.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

#### `cancel_digital_output_schedule()` (async available)

`device_io.cancel_digital_output_schedule(channel_number)`

Cancels a scheduled digital output action.

Requires at least Firmware 7.37.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

#### `get_all_analog_inputs()` (async available)

`device_io.get_all_analog_inputs()`

Returns the current values of all analog input channels.

##### Return Value

Type: `List[float]`

Measurements of the voltages present on the input channels.

#### `get_all_analog_outputs()` (async available)

`device_io.get_all_analog_outputs()`

Returns the current values of all analog output channels.

##### Return Value

Type: `List[float]`

Measurements of voltage that the output channels are conducting.

#### `get_all_digital_inputs()` (async available)

`device_io.get_all_digital_inputs()`

Returns the current values of all digital input channels.

##### Return Value

Type: `List[bool]`

True if voltage is present on the input channel and false otherwise.

#### `get_all_digital_outputs()` (async available)

`device_io.get_all_digital_outputs()`

Returns the current values of all digital output channels.

##### Return Value

Type: `List[bool]`

True if the output channel is conducting and false otherwise.

#### `get_all_labels()` (async available)

`device_io.get_all_labels()`

Returns every label assigned to an IO port on this device.

##### Return Value

Type: [`List[IoPortLabel]`](https://software.zaber.com/motion-library/api/py/ascii/ioportlabel.md)

The labels set for this device's IO.

#### `get_analog_input()` (async available)

`device_io.get_analog_input(channel_number)`

Returns the current value of the specified analog input channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

##### Return Value

Type: `float`

A measurement of the voltage present on the input channel.

#### `get_analog_output()` (async available)

`device_io.get_analog_output(channel_number)`

Returns the current values of the specified analog output channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

##### Return Value

Type: `float`

A measurement of voltage that the output channel is conducting.

#### `get_channels_info()` (async available)

`device_io.get_channels_info()`

Returns the number of I/O channels the device has.

##### Return Value

Type: [`DeviceIOInfo`](https://software.zaber.com/motion-library/api/py/ascii/deviceioinfo.md)

An object containing the number of I/O channels the device has.

#### `get_digital_input()` (async available)

`device_io.get_digital_input(channel_number)`

Returns the current value of the specified digital input channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

##### Return Value

Type: `bool`

True if voltage is present on the input channel and false otherwise.

#### `get_digital_output()` (async available)

`device_io.get_digital_output(channel_number)`

Returns the current value of the specified digital output channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |

##### Return Value

Type: `bool`

True if the output channel is conducting and false otherwise.

#### `get_label()` (async available)

`device_io.get_label(port_type, channel_number)`

Returns the label of the specified channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `port_type` | [`IoPortType`](https://software.zaber.com/motion-library/api/py/ascii/ioporttype.md) | The type of channel to get the label of. |
| `channel_number` | `int` | Channel number starting at 1. |

##### Return Value

Type: `str`

The label of the specified channel.

#### `set_all_analog_outputs()` (async available)

`device_io.set_all_analog_outputs(values)`

Sets values for all analog output channels.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `values` | `List[float]` | Voltage values to set the output channels to. |

#### `set_all_analog_outputs_schedule()` (async available)

`device_io.set_all_analog_outputs_schedule(values, future_values, delay, unit = Units.NATIVE)`

Sets current and future values for all analog output channels.

Requires at least Firmware 7.38.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `values` | `List[float]` | Voltage values to set the output channels to immediately. |
| `future_values` | `List[float]` | Voltage values to set the output channels to in the future. |
| `delay` | `float` | Delay between setting current values and setting future values. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Units of time. |

#### `set_all_digital_outputs()` (async available)

`device_io.set_all_digital_outputs(values)`

Sets values for all digital output channels.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `values` | [`List[DigitalOutputAction]`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of action to perform on the channel. |

#### `set_all_digital_outputs_schedule()` (async available)

`device_io.set_all_digital_outputs_schedule(values, future_values, delay, unit = Units.NATIVE)`

Sets current and future values for all digital output channels.

Requires at least Firmware 7.37.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `values` | [`List[DigitalOutputAction]`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of actions to perform immediately on output channels. |
| `future_values` | [`List[DigitalOutputAction]`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of actions to perform in the future on output channels. |
| `delay` | `float` | Delay between setting current values and setting future values. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Units of time. |

#### `set_analog_input_lowpass_filter()` (async available)

`device_io.set_analog_input_lowpass_filter(channel_number, cutoff_frequency, 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

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |
| `cutoff_frequency` | `float` | Cutoff frequency of the low-pass filter. |
| `unit` | [`FrequencyUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Units of frequency. |

#### `set_analog_output()` (async available)

`device_io.set_analog_output(channel_number, value)`

Sets value for the specified analog output channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |
| `value` | `float` | Value to set the output channel voltage to. |

#### `set_analog_output_schedule()` (async available)

`device_io.set_analog_output_schedule(channel_number, value, future_value, delay, unit = Units.NATIVE)`

Sets current and future value for the specified analog output channel.

Requires at least Firmware 7.38.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |
| `value` | `float` | Value to set the output channel voltage to immediately. |
| `future_value` | `float` | Value to set the output channel voltage to in the future. |
| `delay` | `float` | Delay between setting current value and setting future value. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Units of time. |

#### `set_digital_output()` (async available)

`device_io.set_digital_output(channel_number, value)`

Sets value for the specified digital output channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |
| `value` | [`DigitalOutputAction`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of action to perform on the channel. |

#### `set_digital_output_schedule()` (async available)

`device_io.set_digital_output_schedule(channel_number, value, future_value, delay, unit = Units.NATIVE)`

Sets current and future value for the specified digital output channel.

Requires at least Firmware 7.37.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `channel_number` | `int` | Channel number starting at 1. |
| `value` | [`DigitalOutputAction`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of action to perform immediately on the channel. |
| `future_value` | [`DigitalOutputAction`](https://software.zaber.com/motion-library/api/py/ascii/digitaloutputaction.md) | The type of action to perform in the future on the channel. |
| `delay` | `float` | Delay between setting current value and setting future value. |
| `unit` | [`TimeUnits`](https://software.zaber.com/motion-library/api/py/root/units.md) | Units of time. |

#### `set_label()` (async available)

`device_io.set_label(port_type, channel_number, label)`

Sets the label of the specified channel.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `port_type` | [`IoPortType`](https://software.zaber.com/motion-library/api/py/ascii/ioporttype.md) | The type of channel to set the label of. |
| `channel_number` | `int` | Channel number starting at 1. |
| `label` | `Optional[str]` | The label to set for the specified channel. If no value or an empty string is provided, this label is deleted. |
