adafruit / Adafruit_CircuitPython_DotStar

Dotstarrin' away in CircuitPython land
MIT License
47 stars 38 forks source link

Change more led dots directly #54

Closed miloit closed 3 years ago

miloit commented 3 years ago

Hello, how can I change a range of led dots at the same time?

kattni commented 3 years ago

@miloit You would use a slice to change a range of LEDs. For example, you would use the following code to light up the first five DotStar LEDs. This line of code assumes you setup the DotStars as dotstars.

dotstars[0:5] = (255, 255, 0) * 5

Slicing works the same in CircuitPython as it does in Python, however, you need to include the * N (where N is the size of the slice) after the RGB color tuple so it generates the color for all of the members of the slice.

Hopefully this helps. I'm going to close this issue. For future reference, you'll get better assistance with questions like this on the Adafruit forums or the Adafruit Discord. If you need further assistance, please choose one of those two options to pursue your question. Thanks!