kopia lustrzana https://github.com/blaz-r/pi_pico_neopixel
faster generation of zero-arrays
rodzic
4932d91202
commit
7bc29398d2
|
@ -68,7 +68,7 @@ class Neopixel:
|
||||||
#]
|
#]
|
||||||
|
|
||||||
def __init__(self, num_leds, state_machine, pin, mode="RGB", delay=0.0001):
|
def __init__(self, num_leds, state_machine, pin, mode="RGB", delay=0.0001):
|
||||||
self.pixels = array.array("I", [0 for _ in range(num_leds)])
|
self.pixels = array.array("I", [0] * num_leds)
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.W_in_mode = 'W' in mode
|
self.W_in_mode = 'W' in mode
|
||||||
if self.W_in_mode:
|
if self.W_in_mode:
|
||||||
|
@ -248,4 +248,5 @@ class Neopixel:
|
||||||
|
|
||||||
# Clear the strip
|
# Clear the strip
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.pixels = array.array("I", [0 for _ in range(self.num_leds)])
|
self.pixels = array.array("I", [0] * self.num_leds)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue