dot3k LEDbar KIT effect

I don’t know if this is the right place or not so please rove accordingly.

I’m still learning how to write in python so I thought I’d try a kind of KIT (the car in Knight Rider) effect (the lights behind the grill) on the LED bar. The script I’ve written has managed to get it to go back and forth. Is there a way I can just repeat the same part until I say stop.


In Python you use while True: to loop something until you hit ctrl-c on the keyboard. So, your code would look something like this:

while True:
    your code 1
    your code 2
    your code 3

Note that the indentation is important. Indent only the code you want looped 4 spaces. After that, resume to your normal no indentation.

Hope this helps!


thanks, I didn’t think it would be that simple

1 Like

is there a way to make 2 LEDs come on and go off at the same time?


I’m unfamiliar with the dot3k, but I can give you the basic structure of the code. At the very beginning, type
import time. Then, find the spot where you would like to turn on the LEDs and type something like this

time.sleep('a value in seconds')

Again, replace the led1/2.on/off() commands with the appropriate ones for the dot3k.

Oh yeah, I’m already using import time for a delay. I just had to swap them around. Thanks again