GlowBit.py
|
The class specific to the GlowBit Rainbow. More...
Public Member Functions | |
def | __init__ (self, numLEDs=13, pin=18, brightness=40, rateLimitFPS=60, sm=0) |
Initialisation routine for GlowBit rainbow modules. More... | |
def | pixelSetAngle (self, angle, colour) |
Sets the colour of a pixel on the GlowBit Rainbow, addressed by its angle label. More... | |
def | drawRainbow (self, offset=0) |
Colours each pixel to display a rainbow spectrum. More... | |
def | demo (self) |
Displays a rainbow animation in an infinite loop. More... | |
Public Member Functions inherited from glowbit.stick | |
def | __init__ (self, numLEDs=8, pin=18, brightness=20, rateLimitFPS=30, sm=0) |
Initialisation routine for GlowBit stick modules and tiled arrays thereof. More... | |
def | addPulse (self, speed=100, colour=[0xFFFFFF], index=0, colourMap=None) |
Add a pulse to the list of pulses. More... | |
def | updatePulses (self) |
Update the position of all pulses in self.pulses[] and draw them to the internal buffer. More... | |
def | newGraph1D (self, minIndex=0, maxIndex=7, minValue=0, maxValue=255, colour=0xFFFFFF, colourMap="Solid", update=False) |
Wrapper function to create graph1D objects. More... | |
def | updateGraph1D (self, graph, value) |
Updates a graph1D object, drawing it to the display. More... | |
def | fillSlice (self, i=0, j=-1, colour=0xFFFFFF) |
Fill a "slice" of the GlowBit stick's pixels with a solid colour. More... | |
def | pulseDemo (self, iters=100) |
A demonstration of the use of "pulse" objects. More... | |
def | graphDemo (self, iters=3) |
A demonstration of the use of "graph1D" objects. More... | |
def | sliceDemo (self) |
A Demonstration of the use of the "fillSlice" method. More... | |
def | rainbowDemo (self, iters=5) |
Uses the colourMapRainbow() colour map to display a colourful animation. | |
def | demo (self) |
Runs several demo patterns. | |
Public Member Functions inherited from glowbit.glowbit | |
def | pixelsShow (self) |
Pushes the internal pixel data buffer to the physical GlowBit LEDs. More... | |
def | pixelSet (self, i, colour) |
Sets the i'th GlowBit LED to a 32-bit GlowBit colour value. More... | |
def | pixelSetNow (self, i, colour) |
Sets the i'th GlowBit LED to a 32-bit GlowBit colour value and updates the physical LEDs. More... | |
def | pixelAdd (self, i, colour) |
Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer only. More... | |
def | pixelSaturatingAdd (self, i, colour) |
Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer. More... | |
def | pixelsFill (self, colour) |
Fills all pixels with a solid colour value. More... | |
def | pixelsFillNow (self, colour) |
Fills all pixels with a solid colour value and updates the physical LEDs. More... | |
def | blankDisplay (self) |
Blanks the entire GlowBit display. More... | |
def | getPixel (self, N) |
Returns the 32-bit GlowBit colour value of the i'th LED. More... | |
def | updateRateLimitFPS (self, rateLimitFPS) |
Sets a new value for the GlowBit display's frames per second (FPS) limiter. More... | |
def | power (self) |
Calculates an estimate for the total power draw given the current display data. More... | |
def | chaos (self, iters=100) |
Sets random colour values on every LED on the attached GlowBit display. More... | |
Public Member Functions inherited from glowbit.colourFunctions | |
def | wheel (self, pos) |
Converts an integer "colour wheel position" to a packed 32-bit RGB GlowBit colour value. More... | |
def | rgbColour (self, r, g, b) |
Converts the r, g, and b integer arguments to a packed 32-bit RGB GlowBit colour value. More... | |
def | glowbitColour2RGB (self, colour) |
Converts a 32-bit GlowBit colour value to an (R,G,B) tuple. More... | |
def | red (self) |
Returns the GlowBit colour value for pure red. | |
def | green (self) |
Returns the GlowBit colour value for pure green. | |
def | blue (self) |
Returns the GlowBit colour value for pure blue. | |
def | yellow (self) |
Returns the GlowBit colour value for yellow. | |
def | purple (self) |
Returns the GlowBit colour value for purple. | |
def | cyan (self) |
Returns the GlowBit colour value for cyan. | |
def | white (self) |
Returns the GlowBit colour value for white. | |
def | black (self) |
Returns the GlowBit colour value for black. | |
Public Member Functions inherited from glowbit.colourMaps | |
def | colourMapSolid (self, index, minIndex, maxIndex) |
Trivial colourmap method which always returns the colour in the parent object. More... | |
def | colourMapRainbow (self, index, minIndex, maxIndex) |
Maps the pure hue colour wheel between minIndex and maxIndex. More... | |
Additional Inherited Members | |
Public Attributes inherited from glowbit.stick | |
sm | |
pixelsShow | |
ticks_ms | |
numLEDs | |
strip | |
lastFrame_ms | |
ar | |
dimmer_ar | |
rateLimit | |
brightness | |
pulses | |
Public Attributes inherited from glowbit.glowbit | |
lastFrame_ms | |
rateLimit | |
Static Public Attributes inherited from glowbit.glowbit | |
sideset_init | |
OUT_LOW | |
out_shiftdir | |
SHIFT_LEFT | |
autopull | |
True | |
pull_thresh | |
The class specific to the GlowBit Rainbow.
This class inherits all the functionality of the GlowBit Stick and extends it with Rainbow-specific methods.
def glowbit.rainbow.__init__ | ( | self, | |
numLEDs = 13 , |
|||
pin = 18 , |
|||
brightness = 40 , |
|||
rateLimitFPS = 60 , |
|||
sm = 0 |
|||
) |
Initialisation routine for GlowBit rainbow modules.
numLEDs | The total number of LEDs. Should be set to 13 * (the number of tiled modules). |
pin | The GPIO pin connected to the GlowBit Rainbow module. Defaults to 18 as that pin is compatible with the Raspberry Pi and Raspberry Pi Pico. Any pin can be used on the Raspberry Pi Pico, only pins 18 and 12 are valid on the Raspberry Pi. |
brightness | The relative brightness of the LEDs. Colours drawn to the internal buffer should be in the range [0,255] and the brightness parameter scales this value before drawing to the physical display. If brightness is an integer it should be in the range [0,255]. If brightness is floating point it is assumed to be in the range [0,1.0]. |
rateLimitFPS | The maximum frame rate of the display in frames per second. The pixelsShow() function blocks to enforce this limit. |
def glowbit.rainbow.demo | ( | self | ) |
Displays a rainbow animation in an infinite loop.
This method demonstrates the use of drawRainbow().
def glowbit.rainbow.drawRainbow | ( | self, | |
offset = 0 |
|||
) |
Colours each pixel to display a rainbow spectrum.
This method calls pixelsShow().
offset | A "phase" offset mapping [0,360] degrees to [0,255]. A value of 0 displays red at angle 0 and purple at angle 180. A modulo-255 operation is performed, allowing this value to be any integer. The rainLoop() method varies this value to display an animation. |
def glowbit.rainbow.pixelSetAngle | ( | self, | |
angle, | |||
colour | |||
) |
Sets the colour of a pixel on the GlowBit Rainbow, addressed by its angle label.
angle | An integer number in degrees equal to an angle label on the GlowBit Rainbow PCB. |
colour | A 32-bit GlowBit colour value |