![Digi XGI-20CZ7-E00-W0 Скачать руководство пользователя страница 56](http://html1.mh-extra.com/html/digi/xgi-20cz7-e00-w0/xgi-20cz7-e00-w0_user-manual_2496341056.webp)
Program XBee Industrial Gateway using Python
Sample programs
Digi XBee Industrial Gateway
56
n
n
LED control
Controlling the LEDs on XBee Industrial Gateway is handled through the user_led_set function. This
sample program controls the Network LED.
Note that if native features are still assigned to the LED, those behaviors will mix with the behaviors in
the sample program.
Note
The highlighted numbers in the sample code correspond to the items in the Program Notes,
below.
import digihw
(1)
import time
while True:
digihw.user_led_set(True,1)
(2)
time.sleep(1.0)
digihw.user_led_set(False,1)
(3)
digihw.user_led_set(True, 2)
(4)
time.sleep(1.0)
digihw.user_led_set(False,2)
(5)
Program notes
1. The digihw module includes the user_led_set function needed by the program. The user_led_
set has two are two parameters: value and led. The user controlled LED is made to match the
logic state of the “value” parameter. A value of “True” turns on the LED, and a value of “False”
turns it off. The “led” parameter indicates which user LED to blink, with LED 1 being the default.
2. Turn on the “yellow” Network LED.
3. Turn off the “yellow” Network LED.
4. Turn on the “green” Network LED.
5. Turn off the “green” Network LED.
Watchdog
The watchdog feature, provided through the watchdog module, exists as a safeguard. If there are
critical operations that “must” happen periodically, or else the system will be irretrievably broken, an
application can request that a “watchdog” be established. If the application threads do not service
their watchdog within the promised interval, the entire system reboots. You can change or, if
necessary, delete the intervals for these software watchdogs . Using a software watchdog exists as a
measure of last resort. Appropriate error detection and handling with Python scripts is certainly
recommended.
The following sample program demonstrates the watchdog feature.
Note
The highlighted numbers in the sample code correspond to the items in the Program Notes,
below.
Содержание XGI-20CZ7-E00-W0
Страница 1: ...Digi XBee Industrial Gateway User Guide...