Digi IX30 User Manual page 656

Table of Contents

Advertisement

Applications
Return information about digital I/O ports
1. Select a device in Remote Manager that is configured to allow shell access to the admin user,
and click Actions > Open Console. Alternatively, log into the IX30 local command line as a user
with shell access.
Depending on your device configuration, you may be presented with an Access selection
menu. Type shell to access the device shell.
2. At the shell prompt, use the python command with no parameters to enter an interactive
Python session:
# python
Python 3.10.1 (default, May
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
3. Import the dio module and the Name class:
>>> from digidevice import dio
>>> from digidevice.dio import Name
>>>
The Name class uses the following naming:
Digital I/O port 1: Name.dio1
n
Digital I/O port 2: Name.dio2
n
Digital I/O port 3: Name.dio3
n
Digital I/O port 4: Name.dio4
n
4. To determine the direction of a digital I/O port, use the get_direction function:
>>> dio.get_direction(Name.dio1)
<Direction.input: 'IN'>
Returns either:
Direction.input: IN: The direction is input.
n
Direction.output: OUT: The direction is output.
n
5. To determine the whether a digital I/O port is set to active-low or active-high, use the get_
input function:
>>> dio.get_input(Name.dio1)
<State.on: '1'>
Returns either:
State.off: 0: The port is set to active-low.
n
State.on: 1: The port is set to active-high.
n
6. To determine the current output state of a digital I/O output port, use the get_output
function:
>>> dio.get_output(Name.dio1)
<State.on: '1'>
IX30 User Guide
9 2021, 22:49:59)
Develop Python applications
656

Advertisement

Table of Contents
loading

Table of Contents