Open gumush opened 2 years ago
I came here hoping to find out about performance and any limits. Your post is concerning. The project I'm planning would have around 830 LEDs, and I was hoping to control it with a Pi Nano. If anyone could chime in with whether this is realistic or not it would be appreciated!
since python is an interpreted language it is slow when updating large number of leds with a high refresh rate. It is best to stick with C++ libraries in arduino
You can control when a write to the strip happens. Set auto_write
to false in the constructor, and call show()
when you want to send the state to the strip. I didn't do that below because I don't know how you want it to look.
Also, in the loop above, factor out the constant values. Create them once outside the loop. For instance:
RED = (255, 0, 0)
OFF = (0, 0, 0)
def run(position ,color , speed , size ):
turnoff()
wait = 1/(speed*60) # only needs to be computed once
clean = int(60*size) # only needs to be computed once
for i in range(position):
#print(f'Clean:{clean} Wait:{wait} I:{i}') # Don't print if you don't need to.
pixels[i]=RED
if i-clean>0:
pixels[i-clean]=OFF
else:
pixels[0]=OFF
# time.sleep(0.001)
turnoff()
I use simple led move but it's very very slow in 1800leds ( just 30m 60led/meter )
Is there any way to speed this thing up ?
I guess in microcontrollers this would be better ?