Skip to content

interface

ninglesby edited this page Feb 10, 2018 · 2 revisions

Overview

The interface is responsible for all input and output by a human operator.

Function: set_gpio_mode

Helper function run at the beginning of the overview. It checks the validity of the input from the config.

returns False if successful, otherwise returns an error message.

Class: FrankiesLog

Sets up logging for the app. See python logging module help for more details.

Class: LightThread

This class manages an RGBLightController object. When initializing the class it needs to be passed the RGBLightController object. For example:

lite = RGBLightController()

lightthread = LightThread(lite=lite)

Since this class is a threading class it needs to be started. By having this class be a thread, we can change settings in the class and always having it running in the background which is nice if we want to do more interesting things than just turning the light on or off.

lightthread.start()

If the thread needs to be killed, it can be just by joining.

lightthread.join()

Variable: LightThread.mode (int)

There are currently 9 modes

  • MODE 0: Off
  • MODE 1: Cycle through all the hues at 100% brightness
  • MODE 2: Constant Color
  • MODE 3: Slow Blink
  • MODE 4: Medium Blink
  • MODE 5: Fast Blink
  • MODE 6: Slow Pulse
  • MODE 7: Medium Pulse
  • MODE 8: Fast Pulse

Set the mode by setting the variable to the appropriate number.

lightthread.mode = 2

Variable: LightThread.color (list)

Sets the color of the light. It is expecting a list with three values for red, green and blue. The values should be expressed as a percent of output from 0-100

lightthread.color = [75, 75, 0] # yellow