-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continued development - not quite there yet!
- Loading branch information
Showing
16 changed files
with
387 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import colorsys | ||
import time | ||
from pixelpi import PixelPi | ||
from pixelpi import Strip | ||
|
||
""" | ||
Available strip types (note, setting the white element of LEDs is currently not supported): | ||
strip1 = Strip(1, 300, brightness=40) | ||
strip2 = Strip(2, 300, brightness=40) | ||
strip3 = Strip(3, 300, brightness=40) | ||
strip4 = Strip(4, 300, brightness=40) | ||
|
||
* `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` | ||
""" | ||
|
||
strip = PixelPi(1, 300, striptype='WS2811_GRB', brightness=40) | ||
strip = PixelPi(2, 300, striptype='WS2811_GRB', brightness=40) | ||
strip = PixelPi(3, 300, striptype='WS2811_GRB', brightness=40) | ||
strip = PixelPi(4, 300, striptype='WS2811_GRB', brightness=40) | ||
|
||
strip.clearStrip() | ||
strip.showStrip() | ||
for strip in [strip1, strip2, strip3, strip4]: | ||
strip.clearStrip() | ||
strip.showStrip() | ||
del strip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,30 @@ | ||
from time import sleep | ||
|
||
from PIL import Image | ||
from pixelpi import PixelPi | ||
from pixelpi import Strip | ||
|
||
im = Image.open("image.png").convert(mode='RGB', colors=256) | ||
|
||
# strip1 = Strip(2, (8, 8), striptype='SK6812_GRBW', stripshape="matrix", brightness=0.2) | ||
strip2 = PixelPi(2, (8, 32), striptype='WS2812', stripshape="zmatrix", brightness=0.2) | ||
# strip1 = Strip(2, (8, 8), ledtype='SK6812_GRBW', shape="matrix", brightness=0.2) | ||
strip = Strip(terminal=2, size=(8, 32), ledtype='WS2812', shape="zmatrix", brightness=30) | ||
|
||
i = 0 | ||
while True: | ||
i = i + 1 | ||
if i >= 32: | ||
i = 0 | ||
im = im.transpose(Image.ROTATE_90) | ||
# strip1.set_image(im) | ||
strip2.setImage(im, (0, i)) | ||
strip2.showStrip() | ||
sleep(0.5) | ||
im = im.transpose(Image.ROTATE_90) | ||
# strip1.set_image(im) | ||
strip2.setImage(im, (0, i)) | ||
strip2.showStrip() | ||
sleep(0.5) | ||
im = im.transpose(Image.ROTATE_90) | ||
# strip1.set_image(im) | ||
strip2.setImage(im, (0, i)) | ||
strip2.showStrip() | ||
sleep(0.5) | ||
im = im.transpose(Image.ROTATE_90) | ||
# strip1.set_image(im) | ||
strip2.setImage(im, (0, i)) | ||
strip2.showStrip() | ||
sleep(0.5) | ||
strip2.clearStrip() | ||
strip2.showStrip() | ||
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.setLED(led=(0, i), image=im) | ||
strip.showStrip() | ||
sleep(0.5) | ||
|
||
strip.clearStrip() | ||
strip.showStrip() | ||
|
||
except KeyboardInterrupt: | ||
strip.clearStrip() | ||
strip.showStrip() | ||
del strip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import colorsys | ||
import time | ||
|
||
import colorsys | ||
from pixelpi import Strip | ||
|
||
strip1 = Strip(2, 300, stripshape='straight', striptype='WS2811_GRB', brightness=50) | ||
# strip2 = Strip(2, 10, striptype='SK6812_GRBW', brightness=50) | ||
# strip3 = Strip(3, 10, striptype='WS2811_RGB', brightness=50) | ||
# strip4 = Strip(4, 10, striptype='WS2811_RGB', brightness=50) | ||
# 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) | ||
|
||
spacing = 360.0 / 16.0 | ||
hue = 0 | ||
|
||
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)] | ||
strip1.setLED(r, g, b, LED=x) | ||
# strip2.setLED(x, r, g, b) | ||
# strip3.setLED(x, r, g, b) | ||
# strip4.setLED(x, r, g, b) | ||
|
||
strip1.showStrip() | ||
# strip2.showStrip() | ||
# strip3.showStrip() | ||
# strip4.showStrip() | ||
time.sleep(0.001) | ||
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.setLED(rgb=(r, g, b), led=x) | ||
|
||
for strip in [strip1, strip2, strip3, strip4]: | ||
strip.showStrip() | ||
|
||
time.sleep(0.001) | ||
|
||
except KeyboardInterrupt: | ||
for strip in [strip1, strip2, strip3, strip4]: | ||
strip.clearStrip() | ||
strip.showStrip() | ||
del strip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
import colorsys | ||
import numpy | ||
import time | ||
from pixelpi import PixelPi | ||
from typing import Any | ||
|
||
strip2 = PixelPi(2, 256, striptype='WS2812', brightness=40) | ||
from pixelpi import Strip | ||
|
||
strip2.clearStrip() | ||
colourarray = strip2.getStrip | ||
strip = Strip(2, 256, striptype='WS2812', brightness=40) | ||
|
||
strip.clearStrip() | ||
colourarray = strip.getLED() | ||
|
||
print(colourarray) | ||
|
||
for pixel in range(len(colourarray)): | ||
colourarray[pixel] = [pixel, 0, 255 - pixel, 51] | ||
|
||
while True: | ||
strip2.sequence_set(colourarray) | ||
# strip2.sequence_reflect(colourarray) | ||
strip2.showStrip() | ||
strip.setLED(pattern=colourarray) | ||
strip.showStrip() | ||
# time.sleep(0.2) | ||
colourarray = strip2.sequence_rotate(colourarray, 1) | ||
colourarray = strip.rotateStrip(colourarray, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,67 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
from pixelpi import PixelPi | ||
|
||
from pixelpi import Strip | ||
|
||
""" | ||
Available strip types (note, setting the white element of LEDs is currently not supported): | ||
* `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` | ||
Change the parameters below until you see the colours indicated on the screen: | ||
terminal = The screw terminal your LEDs are connected to | ||
size = The number of LEDs in your terminal (can be (x, y) for a matrix) | ||
shape = The 'shape' of the terminal. | ||
* `matrix` - a normal matrix where the led order goes left to right. i.e: | ||
1 2 3 4 | ||
5 6 7 8 | ||
9 . . . | ||
* `zmatrix` - A matrix where the pixels 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 = PixelPi(1, (8, 32), striptype='WS2812', stripshape="zmatrix", brightness=0.2) | ||
print(strip.getStripType) | ||
strip = Strip(4, (8, 32), shape="zmatrix", ledtype='WS2812', brightness=30) | ||
|
||
while True: | ||
print("Red") | ||
strip.set_all(255, 0, 0) | ||
strip.showStrip() | ||
time.sleep(1) | ||
try: | ||
while True: | ||
print("Red") | ||
strip.setLED(rgb=(255, 0, 0)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
print("Green") | ||
strip.set_all(0, 255, 0) | ||
strip.showStrip() | ||
time.sleep(1) | ||
print("Green") | ||
strip.setLED(rgb=(0, 255, 0)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
print("Blue") | ||
strip.set_all(0, 0, 255) | ||
strip.showStrip() | ||
time.sleep(1) | ||
print("Blue") | ||
strip.setLED(rgb=(0, 0, 255)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
strip.clearStrip() | ||
strip.showStrip() | ||
|
||
for y in range(strip.getHeight): | ||
for x in range(strip.getWidth): | ||
led = (x, y) | ||
print("White: ", led) | ||
strip.setLED(rgb=(255, 255, 255), led=led) | ||
strip.showStrip() | ||
time.sleep(0.25) | ||
strip.setLED(rgb=(0, 0, 0), led=led) | ||
strip.showStrip() | ||
|
||
except KeyboardInterrupt: | ||
strip.clearStrip() | ||
strip.showStrip() | ||
|
||
for y in range(strip.getHeight): | ||
for x in range(strip.getWidth): | ||
pixel = (x, y) | ||
strip.set_pixel(pixel, 255, 255, 255) | ||
strip.showStrip() | ||
time.sleep(0.25) | ||
strip.set_pixel(pixel, 0, 0, 0) | ||
strip.showStrip() | ||
del strip |
Oops, something went wrong.