Running the LED Controller Application

You can start the LED Controller example application as a service and optionally enable it to automatically run on boot, or you can run it from the command line. Running from the command line is useful for doing interactive testing and debugging. Running as a service is useful for setting up working networks and demonstrations.

 

To start the LED Controller example application as a service and enable it to run on boot, enter the following command:

izot_enable led

To stop the LED Controller example application and disable it from running on boot, enter the following command:

izot_disable led

To start the LED Controller example application without changing its boot status, enter the following command:

izot_start led

To stop the LED Controller example application without changing its boot status, enter the following command:

izot_stop led

To display the status of all IzoT services, enter the following command.

izot_stat

To run the LED Controller example application from the command line, change to the LED Controller example directory at $IZOT/izot/examples/led_controller and enter the following command at the Linux shell prompt:

supy led.py [-C] [-D] [-d DEVICE] [-h] [-I] [-i] [-L LED_TYPE] [-l LOG] [-m] [-N SCENES] [-n NVD] [-p PROGRAM_ID] [-s SENSOR] [-v] [-r RESET_TYPE]

The following table summarizes the command-line flags and options:

  
Flag / Option Description
-C Enables debugging with the PyCharm IDE.
-D Runs the LED Controller example applicaiton in debug mode. The log level is increased for both the console log and the application log.
-d DEVICE Sets the device URI, e.g. uc://10.0.1.12:1628. If not specified the default URI is used.
-h Displays the available flags and options.
-I Disables ISI. Without ISI, the application requires installation by a network management tool such as the IzoT Commissioning Tool.
-i Runs the LED Controller without any attached I/O hardware. This is useful for running the LED Controller on platforms that do not have the LED Controller I/O hardware.
-L LED_TYPE Specifies the LED type. LED_TYPE can be color or piface. If the value is color, six channels of a 16-channel PWM controller are used to control two color LEDs. If the value is piface, two digital outputs on a PiFace Digital I/O board are used. If not specified, the default LED type is color.
-l LOG Sets the path and filename for log files. If not specified, the default path is the LED Controller example directory, and the filename is LED.
-m Runs the LED Controller in demo mode. In demo mode, periodic ISI messaging is increased to speed up device and connection discovery. The result is that more bandwidth is consumed for ISI messaging provide faster discovery at the expense of less bandwidth for application data.
-N SCENES Specifies the number of scenes to be supported by the LED Controller. The SCENES value must be an integer value between 2 and 16, inclusive. If not specified, the default is 8 scenes.
-n NVD Specifies the path for the non-volatile data directory. If not specified the default directory is LED-nvd in the LED Controller example directory.
-p PROGRAM_ID Specifies a program ID for this running instance of the application. PROGRAM_ID is a 16-digit hex value described in the Standard Program ID. If not specified the default program ID for the LED Controller example application is 9F:FF:FF:05:00:6F:00:02. Specify a different program ID if you have modified the IzoT interface for the example application and you need to load a different device class file for the modified application.
-r RESET_TYPE Clears persistant data. Set RESET_TYPE to 0 to clear all persistant data; set RESET_TYPE to 1 to clear all persistant data except for the device unique ID. RESET_TYPE 1 is useful to prevent a change in unique ID which will result in a new discovery of the device by the IzoT Server.
-s SENSOR Specifies the configuration of pressure sensors used for locally controlling the LED state. The following values of SENSOR are supported:
  • none -- no pressure sensors are installed (default)
  • single -- a single pressure sensor is installed to control both LEDs
  • multi -- two pressure sensors are installed, one to control each LED
-v Runs the LED Controller example applicaiton in verbose mode. The log level is increased to the maximum level for both the console log and the application log.