kopia lustrzana https://github.com/blaz-r/pi_pico_neopixel
Porównaj commity
4 Commity
9e956e518d
...
89b06f4383
Autor | SHA1 | Data |
---|---|---|
blaz-r | 89b06f4383 | |
Blaž Rolih | 8f158e6390 | |
Blaž Rolih | 30f8314330 | |
blaz-r | aef5b0db81 |
18
neopixel.py
18
neopixel.py
|
@ -234,12 +234,16 @@ class Neopixel:
|
|||
set_pixel processes the slice)
|
||||
|
||||
:param idx: Index can either be indexing number or slice
|
||||
:param rgb_w: Tuple of form (r, g, b) or (r, g, b, w) representing color to be used
|
||||
:return:
|
||||
:param rgb_w: Tuple (or list of tuples) of form (r, g, b) or (r, g, b, w) representing color to be used
|
||||
:return: None
|
||||
"""
|
||||
if type(rgb_w) is list:
|
||||
for i in range(self.num_leds):
|
||||
self.set_pixel(i, rgb_w[i])
|
||||
# set some subset, if idx is a slice:
|
||||
if type(idx) is slice:
|
||||
for rgb_i, pixel_i in enumerate(range(*idx.indices(self.num_leds))):
|
||||
self.set_pixel(pixel_i, rgb_w[rgb_i])
|
||||
else:
|
||||
raise ValueError("Index must be a slice when setting multiple pixels as list")
|
||||
else:
|
||||
self.set_pixel(idx, rgb_w)
|
||||
|
||||
|
@ -337,9 +341,9 @@ class Neopixel:
|
|||
cut = 8
|
||||
if self.W_in_mode:
|
||||
cut = 0
|
||||
sm_put = self.sm.put
|
||||
for pixval in self.pixels:
|
||||
sm_put(pixval, cut)
|
||||
|
||||
self.sm.put(self.pixels, cut)
|
||||
|
||||
time.sleep(self.delay)
|
||||
|
||||
def fill(self, rgb_w, how_bright=None):
|
||||
|
|
Ładowanie…
Reference in New Issue