Slice list in neopixel object
Posted: Thu Mar 25, 2021 10:31 am
Hi everyone,
I am new to the forum. I'm very new in Python and more in micropython. Perhaps my question is an evidence for some of you, I hope.
I use embedded NeoPixel lib of micropython for ESP8266. I create a neopxl object.
As much as I can read the full list of this object so much I can't slice (or update) some elements in this list:
I understood that my request neopxl[1:6] couln't work because neopxl is an object not a list.
Then, how can I slice this list included in this object ?
I am new to the forum. I'm very new in Python and more in micropython. Perhaps my question is an evidence for some of you, I hope.
I use embedded NeoPixel lib of micropython for ESP8266. I create a neopxl object.
As much as I can read the full list of this object
Code: Select all
>>> list(neopxl)
[(0, 0, 0), (0, 2, 0), (0, 2, 0), (0, 2, 0), (0, 2, 0), (0, 2, 0), (0, 0, 0)]
Code: Select all
>>> neopxl[1:5]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neopixel.py", line 24, in __getitem__
TypeError: unsupported types for __mul__: 'slice', 'int'
Then, how can I slice this list included in this object ?