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

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

Advertisement

Applications
5. Type exit to exit the Admin CLI.
Depending on your device configuration, you may be presented with an Access selection
menu. Type quit to disconnect from the device.
See
Configure applications to run automatically
Example digidevice.sms code
The following example code receives an SMS message and sends a response:
#!/usr/bin/python3.6
import os
import threading
from digidevice.sms import Callback, send
c = threading.Condition()
def sms_test_callback(sms):
print(f"SMS message from {sms['from']}received"
print(sms['message'])
c.acquire()
c.notify()
c.release()
my_callback = Callback(sms_test_callback)
print "sending SMS message"
send("destination", "message")
print "
Please send an SMS message now."
print "Execution halted until a message is received or 60 seconds have passed."
# acquire the semaphore and wait until a callback occurs
c.acquire()
try:
c.wait(60.0)
except Exception, e:
print "exception occured while waiting"
print e
c.release()
my_callback.unregister_callback()

Use Python to access serial ports

You can use the Python serial module to access serial ports on your Connect IT Mini device that are
configured to be in Application mode. See for information about configuring a serial port in Application
mode.
To use Python to access serial ports:
1. Log into the Connect IT Mini 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.
Digi Connect IT® Mini User Guide
Use Python to access serial ports
for more information about scheduling scripts.
375

Advertisement

Table of Contents
loading

Table of Contents