The Use(Led) Function; Releasing The Leds To System Control - Digi LR54 User Manual

Hide thumbs Also See for LR54:
Table of Contents

Advertisement

Applications
Type "help", "copyright", "credits" or "license" for more information.
>>>
2. Import the led submodule:
>>> from digidevice import led
3. Import the Led and State objects from the led submodule:
>>> from digidevice.led import Led, State
4. Use led.acquire() to gain control of the all LEDs:
>>> led.acquire(Led.ALL)
5. Use led.set() to set the state of the LEDs:
>>> led.set(Led.ALL, State.FLASH_FAST)
6. (Optional) Use led.release() to release the LEDs to system control:
>>> led.release(Led.ALL)
7. Use Ctrl-D to exit the Python session. You can also exit the session using exit() or quit().

The use(led) function

The use(led) function can be used to acquire control of LEDs and then release them back to system
control.
To create a function that acquires control of the power LED, sets it to a state of fast flashing, and then
releases control when the function has completed, use the following code in a python application:
with use(Led.POWER) as pwr:
pwr(State.FLASH_FAST)

Releasing the LEDs to system control

During a Python interactive session, or from within a Python script, you can release control of the LED
from Python to system control using the led.release() method.
If the Python script or session terminates prior to releasing control to the system, the LEDs will
continue to have the state that Python set to them, until the device is rebooted. See
to run automatically
by the Python script even after reboot.
If any system processes attempt to take control of the LED while Python is in control of it, the state
information from the system process is recorded but the LED state is not updated until Python
releases control of the LED. When the LED is returned to system control, the state of the LED will
reflect the correct, recorded state information.
Setting the state of multi-colored LEDs.
Use Python to send and receive SMS messages
You can create Python scripts that send and receive SMS message in tandem with the Digi Remote
Manager or Digi aView by using the digidevice.sms module. To use a script to send or receive SMS
messages, you must also enable the ability to schedule SMS scripting.
LR54 User Guide
for information about configuring the device so that the LED state is controlled
The use(led) function
Configure scripts
745

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tx64

Table of Contents