RPiSense package¶
Submodules¶
RPiSense.Colors module¶
-
class
RPiSense.Colors.Colors(order=('H', 'L', 'S'), ascending=True)[source]¶ Bases:
objectKeep a list of colors organized and sorted. You can select colors by name, by index number, and even at random.
Parameters: - order – (array_like) This defines the hierarchy of field names when sorting. See the colors.csv file for information about these names.
- ascending – (boolean) Sorting can either be ascending or descending.
-
fetch(key, mode='rgb')[source]¶ Select a color at random.
Parameters: - key – (string) The name of the color to find.
- mode – (‘string’) This is a 3-character description for the color category to return. Valid options are ‘rgb’ (red, green, blue), ‘hsv’ (hue, saturation, value), and ‘HLS’ (HUE, LUMINOSITY, SATURATION).
Returns: - abc (tuple) – Three 8-bit values for the color.
-
random(low=-1, high=-1, mode='rgb')[source]¶ Select a color at random.
Parameters: - low – (integer) The lowest index of the array to use. If low=-1, this defaults to the first index.
- high – (integer) The highest index of the array to use. If high=-1, this defaults to the last index.
- mode – (‘string’) This is a 3-character description for the color category to return. Valid options are ‘rgb’ (red, green, blue), ‘hsv’ (hue, saturation, value), and ‘HLS’ (HUE, LUMINOSITY, SATURATION).
Returns: - name (string) – The name of the color.
- abc (tuple) – Three 8-bit values for the color.
-
randomColor(low=-1, high=-1, mode='rgb')[source]¶ Select a color at random.
Parameters: - low – (integer) The lowest index of the array to use. If low=-1, this defaults to the first index.
- high – (integer) The highest index of the array to use. If high=-1, this defaults to the last index.
- mode – (‘string’) This is a 3-character description for the color category to return. Valid options are ‘rgb’ (red, green, blue), ‘hsv’ (hue, saturation, value), and ‘HLS’ (HUE, LUMINOSITY, SATURATION).
Returns: - abc (tuple) – Three 8-bit values for the color.
-
randomName(low=-1, high=-1, mode='rgb')[source]¶ Select a color at random.
Parameters: - low – (integer) The lowest index of the array to use. If low=-1, this defaults to the first index.
- high – (integer) The highest index of the array to use. If high=-1, this defaults to the last index.
- mode – (‘string’) This is a 3-character description for the color category to return. Valid options are ‘rgb’ (red, green, blue), ‘hsv’ (hue, saturation, value), and ‘HLS’ (HUE, LUMINOSITY, SATURATION).
Returns: - name (string) – The name of the color.
- abc (tuple) – Three 8-bit values for the color.
RPiSense.Compass module¶
-
class
RPiSense.Compass.Compass(sense, fg=(255, 0, 0), bg=(0, 0, 255))[source]¶ Bases:
objectDisplay the direction of North on the LED matrix.
Parameters: - sense – (SenseHat instance) A reference to the SenseHat API
- fg – (tuple) The three 8-bit color values to use for a dot.
- bg – (list) The three 8-bit color values to use for a circle.
RPiSense.Convert module¶
RPiSense.Level module¶
-
class
RPiSense.Level.Level(sense, fg=(255, 255, 255), scale=30)[source]¶ Bases:
objectDisplay a white dot in the LED matrix to mimic the behavior of a bubble in a leveller.
Parameters: - sense – (SenseHat instance) A reference to the SenseHat API
- fg – (tuple) The three 8-bit color values to use for the bubble.
- scale – (integer) The sensitivity to tilting. Higher values are more sensitive.
RPiSense.MakeyJoy module¶
-
class
RPiSense.MakeyJoy.MakeyJoy(sense, makey=False)[source]¶ Bases:
objectReturn a direction of input from either the joystick or the keyboard.
Parameters: - sense – (SenseHat instance) A reference to the SenseHat API
- makey – (boolean) Use Makey Makey (or keyboard) arrows instead of the Sense HAT joystick.
RPiSense.RepeatMe module¶
-
class
RPiSense.RepeatMe.RepeatMe(sense, time=0.5, makey=False)[source]¶ Bases:
objectPlay a game of Repeat After Me. A square will appear on the Sense HAT LED matrix. Press the joystick in the direction of the square. The game will continue adding to the sequence as long as you pick the right direction. Get the sequence right and the display turns green. Get the sequence wrong and the display turns red and you have to start over.
Parameters: - sense – (SenseHat instance) A reference to the SenseHat API
- time – (float) The amount of time to display each entry in the sequence.
- makey – (boolean) Use Makey Makey (or keyboard) arrows instead of the Sense HAT joystick.