-
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.
Merge remote-tracking branch 'origin/master' into master
# Conflicts: # docs/source/library.rst # examples/clear.py # examples/image.py # examples/rainbow.py # examples/sequence.py # examples/testmatrix.py # library/pixelpi/strip.py
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
|
||
from pixelpi import Strip | ||
|
||
""" | ||
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. | ||
* `straight` - A led string (default) | ||
* `reverse` - A led string which starts at the opposite end | ||
* `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 = Strip(terminal=1, size=256, shape='straight', ledtype='WS2812', brightness=40) | ||
|
||
try: | ||
while True: | ||
print("Red") | ||
strip.setLED(rgb=(255, 0, 0)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
print("Green") | ||
strip.setLED(rgb=(0, 255, 0)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
print("Blue") | ||
strip.setLED(rgb=(0, 0, 255)) | ||
strip.showStrip() | ||
time.sleep(1) | ||
|
||
strip.clearStrip() | ||
strip.showStrip() | ||
|
||
for led in range(strip.getLength): | ||
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) | ||
|
||
except KeyboardInterrupt: | ||
strip.clearStrip() | ||
strip.showStrip() | ||
del strip |