Digi IX30 User Manual page 657

Table of Contents

Advertisement

Applications
Returns either:
State.off: 0: The current output state is off.
n
State.on: 1: The current output state is on.
n
If the port direction is input, an error is returned.
n
7. To determine whether the pulse counter of a digital I/O input port is enabled, use the get_
pulse function. This function is available for Digital I/O port 1 only.
>>> dio.get_pulse(Name.dio1)
0
Returns 0 if the pulse counter is enabled. If the pulse counter is not enabled, the following
error is returned:
digidevice.dio.DIOException: Pulse counter is not enabled on port
Name.dio1
8. Use Ctrl-D to exit the Python session. You can also exit the session using exit() or quit().
Set the state of a digital I/O output port
If the direction of a digital I/O port is set to output, you can set the current state of the port:
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 and State classes:
>>> from digidevice import dio
>>> from digidevice.dio import Name, State
>>>
The Name class uses the following naming:
n
l
l
l
l
The State class has the following values:
n
l
l
IX30 User Guide
Digital I/O port 1: Name.dio1
Digital I/O port 2: Name.dio2
Digital I/O port 3: Name.dio3
Digital I/O port 4: Name.dio4
on: Sets the current state of the output port to on.
off: Sets the current state of the output port to off.
9 2021, 22:49:59)
Develop Python applications
657

Advertisement

Table of Contents
loading

Table of Contents