kopia lustrzana https://github.com/blaz-r/pico_python_ws2812b
Added rotate left and right
If you want to scroll your pixels x pixels to te left or rightmain
rodzic
091b767b38
commit
6fd21ff187
11
ws2812b.py
11
ws2812b.py
|
@ -67,6 +67,17 @@ class ws2812b:
|
||||||
|
|
||||||
self.pixels[pixel_num] = blue | red << 8 | green << 16
|
self.pixels[pixel_num] = blue | red << 8 | green << 16
|
||||||
|
|
||||||
|
# rotate x pixels to te left
|
||||||
|
def rotate_left(self, num_of_pixels):
|
||||||
|
if num_of_pixels != None:
|
||||||
|
self.pixels = self.pixels[num_of_pixels:] + self.pixels[:num_of_pixels]
|
||||||
|
|
||||||
|
# rotate x pixels to the right
|
||||||
|
def rotate_right(self, num_of_pixels):
|
||||||
|
if num_of_pixels != None:
|
||||||
|
num_of_pixels = -1 * num_of_pixels
|
||||||
|
self.pixels = self.pixels[num_of_pixels:] + self.pixels[:num_of_pixels]
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
for i in range(self.num_leds):
|
for i in range(self.num_leds):
|
||||||
self.sm.put(self.pixels[i],8)
|
self.sm.put(self.pixels[i],8)
|
||||||
|
|
Ładowanie…
Reference in New Issue