Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master
Browse files Browse the repository at this point in the history
# 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
GeekyTim committed Aug 20, 2020
2 parents b1b397e + 453f5f8 commit 696c120
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions examples/teststring.py
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

0 comments on commit 696c120

Please sign in to comment.