I have 100 adresseable LED:s connected to a RPi and would like to have them blink at random.
My initial thought was to create a randomized list at startup containing the 100 numbers and then turn them on one after another in a loop. After a certain amount of time I would like to turn them off again. RGBlist = [100 random numbers 0-99] for i in RGBlist: turnOnLED(i)
How do I start a second loop to run concurrently with the first one?
delay(X ms) for i in RGBlist: turnOffLED(i)
I don't want all 100 LEDs to turn on before turning them off again one at a time, I'd like LED(x) to turn on, then LED(y), LED(z), LED(x) turn off, LED(u) turn on, LED(y) turn off and so on. Even better if they can be turned off after being lit for an arbitrary time of 100-500 ms.
Do I need to enter the deep, dark caves of multiprocessing and threading for this?
Aucun commentaire:
Enregistrer un commentaire