#!/usr/bin/env python3 from pixelpi import Strip strip1 = Strip(1, 300, brightness=40) strip2 = Strip(2, 300, brightness=40) strip3 = Strip(3, 300, brightness=40) strip4 = Strip(4, 300, brightness=40) for strip in [strip1, strip2, strip3, strip4]: strip.clearLEDs() strip.showLEDs() del strip
5 6 7 8 9 . . . * `zmatrix` - A matrix where the shift in the first row go left to right, the next one right to left. i.e: 1 2 3 4 8 7 6 5 9 . . . ledtype = One of the supported terminal types: WS2812, SK6812, SK6812W, SK6812_RGBW, SK6812_RBGW, SK6812_GRBW, SK6812_GBRW, SK6812_BRGW, SK6812_BGRW, WS2811_RGB, WS2811_RBG, WS2811_GRB, WS2811_GBR, WS2811_BRG, WS2811_BGR brightness = The default brightness for all LEDs (0-255). """ strip = Strip(4, (8, 32), shape="zmatrix", ledtype='WS2812', brightness=30) try: while True: print("Red") strip.setLEDs(rgb=(255, 0, 0)) strip.showLEDs() time.sleep(1) print("Green") strip.setLEDs(rgb=(0, 255, 0)) strip.showLEDs() time.sleep(1) print("Blue") strip.setLEDs(rgb=(0, 0, 255))
#!/usr/bin/env python3 from pixelpi import Strip import time strip = Strip(4, (8, 32), shape="zmatrix", ledtype='WS2812', brightness=30) for x in range(strip.getWidth): strip.setLEDs(led=(x, 0), rgb=(128, 0, 0)) strip.showLEDs() try: while True: strip.shift("up", 2) strip.showLEDs() time.sleep(0.2) except KeyboardInterrupt: strip.clearLEDs() strip.showLEDs() del strip
#!/usr/bin/env python3 import time from pixelpi import Strip strip1 = Strip(1, 180, ledtype='WS2811_GRB', brightness=50) strip2 = Strip(2, 180, ledtype='WS2811_GRB', brightness=50) strip3 = Strip(3, 180, ledtype='WS2811_GRB', brightness=50) strip4 = Strip(4, 180, ledtype='WS2811_GRB', brightness=50) strip1.clearLEDs() pattern = strip1.getLEDs() for pixel in range(int(len(pattern) / 2)): pattern[pixel] = [255, 0, 0, pattern[pixel][3]] pattern[strip1.getLength - pixel - 1] = [0, 0, 255, pattern[strip1.getLength - pixel - 1][3]] for strip in [strip1, strip2, strip3, strip4]: strip.setLEDs(pattern=pattern) try: while True: for strip in [strip1, strip2, strip3, strip4]: strip.mirror() strip.showLEDs() time.sleep(1) except KeyboardInterrupt: for strip in [strip1, strip2, strip3, strip4]:
from time import sleep from PIL import Image from pixelpi import Strip im = Image.open("image.png").convert(mode='RGB', colors=256) # strip1 = Strip(2, (8, 8), ledtype='SK6812_GRBW', shape="matrix", brightness=0.2) strip = Strip(terminal=4, size=(8, 32), ledtype='WS2812', shape="zmatrix", brightness=30) try: i = 0 while True: i = i + 1 if i >= 32: i = 0 for r in range(4): im = im.transpose(Image.ROTATE_90) strip.setLEDs(led=(0, i), image=im) strip.showLEDs() sleep(0.5) strip.clearLEDs() strip.showLEDs() except KeyboardInterrupt:
#!/usr/bin/env python3 from pixelpi import Strip import time strip = Strip(4, (8, 32), shape="zmatrix", ledtype='WS2812', brightness=30) for y in range(strip.getHeight): strip.setLEDs(led=(0, y), rgb=(0, 0, 128)) strip.showLEDs() try: while True: strip.shift("right", 1) strip.showLEDs() time.sleep(0.2) except KeyboardInterrupt: strip.clearLEDs() strip.showLEDs() del strip
leds.showLEDs() except: raise AttributeError('The strip list contained an error.') def whitelights(self): try: if self.__strips is not None: for strip in self.__strips: strip.setLEDs(rgb=(255, 255, 255)) strip.showLEDs() except: raise AttributeError('The strip list contained an error.') # Change the terminal type to the type you have strip1 = Strip(1, 256, ledtype='WS2811_GRB', brightness=30) strip2 = Strip(2, 256, ledtype='WS2811_GRB', brightness=30) strip3 = Strip(3, 256, ledtype='WS2811_GRB', brightness=30) strip4 = Strip(4, 256, ledtype='WS2811_GRB', brightness=30) mybuttons = MyButtons([strip1, strip2, strip3, strip4]) button = PixelPiButton(callingclass=mybuttons, shortpress="clear", longpress="dosomethingelse") spacing = 360.0 / 16.0 hue = 0 try: while True:
5 6 7 8 9 . . . * `zmatrix` - A matrix where the shift in the first row go left to right, the next one right to left. i.e: 1 2 3 4 8 7 6 5 9 . . . ledtype = One of the supported terminal types: WS2812, SK6812, SK6812W, SK6812_RGBW, SK6812_RBGW, SK6812_GRBW, SK6812_GBRW, SK6812_BRGW, SK6812_BGRW, WS2811_RGB, WS2811_RBG, WS2811_GRB, WS2811_GBR, WS2811_BRG, WS2811_BGR brightness = The default brightness for all LEDs (0-255). """ strip = Strip(terminal=1, size=256, shape='straight', ledtype='WS2812', brightness=40) try: while True: print("Red") strip.setLEDs(rgb=(255, 0, 0)) strip.showLEDs() time.sleep(1) print("Green") strip.setLEDs(rgb=(0, 255, 0)) strip.showLEDs() time.sleep(1) print("Blue") strip.setLEDs(rgb=(0, 0, 255))
#!/usr/bin/env python3 import time from pixelpi import Strip strip = Strip(4, (8, 32), shape="zmatrix", ledtype='WS2812', brightness=30) for x in range(int(strip.getWidth / 2)): for y in range(strip.getHeight): strip.setLEDs(led=(x, y), rgb=(128, 0, 0)) strip.setLEDs(led=(strip.getWidth - 1 - x, y), rgb=(0, 0, 128)) strip.showLEDs() try: while True: strip.mirror("horizontal") strip.showLEDs() time.sleep(0.2) except KeyboardInterrupt: strip.clearLEDs() strip.showLEDs() del strip
#!/usr/bin/env python3 import colorsys import time from pixelpi import Strip # Change the terminal type to the type you have strip1 = Strip(1, 180, ledtype='WS2811_GRB', brightness=50) strip2 = Strip(2, 180, ledtype='WS2811_GRB', brightness=50) strip3 = Strip(3, 180, ledtype='WS2811_GRB', brightness=50) strip4 = Strip(4, 180, ledtype='WS2811_GRB', brightness=50) spacing = 360.0 / 16.0 hue = 0 try: while True: hue = int(time.time() * 100) % 360 for x in range(256): offset = x * spacing h = ((hue + offset) % 360) / 360.0 r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)] for strip in [strip1, strip2, strip3, strip4]: strip.setLEDs(rgb=(r, g, b), led=x) for strip in [strip1, strip2, strip3, strip4]: strip.showLEDs() time.sleep(0.001)