Use Python To Access Serial Ports - Digi Connect IT 16 User Manual

Hide thumbs Also See for Connect IT 16:
Table of Contents

Advertisement

Applications
# python
Python 3.6.12 (default, Jan 11 2021, 10:25:21)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
3. Import the hid module:
>>> import hid
>>>
4. Use the help command with hid:
>>> help(hid)
Help on package hid:
NAME
hid
PACKAGE CONTENTS
CLASSES
_ctypes.Structure(_ctypes._CData)
builtins.Exception(builtins.BaseException)
builtins.object
...
>>>
5. Use Ctrl-D to exit the Python session. You can also exit the session using exit() or quit().

Use Python to access serial ports

You can use the Python serial module to access serial ports on your Connect IT 16/48 device that are
configured to be in Application mode. For example, you can configure USB ports to function serial
ports and interact programmatically with those ports. See
about configuring a serial port in Application mode, and see
about configuring USB ports on the device to function as serial ports.
To use Python to access serial ports:
1. Log into the Connect IT 16/48 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. Determine the path to the serial port:
# ls /dev/serial/
by-id
#
Digi Connect IT® 16/48 User Guide
DeviceInfo
HIDException
Device
by-path
by-usb
port1
Use Python to access serial ports
Configure the serial port
Add a USB console port
USB_port1
USB_port2
for information
for information
478

Advertisement

Table of Contents
loading

This manual is also suitable for:

Connect it 48

Table of Contents