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.