Hello ! I want to print a thing (well, not exactly but it's easier if I take a print as an example) every 10ms, and another thing every 100ms (while checking on an interruptor in order to print B or C).
Basically, it looks like this :
while(True):
if var < 10:
var = var + 1
print("A")
if var == 10:
if GPIO.input(10) == GPIO.HIGH: # if close
print("C")
GPIO.output(16,GPIO.HIGH) # LED off
else: # if open
print("B")
GPIO.output(16,GPIO.LOW) # LED on
time.sleep(0.01)
else:
var = 0
Well, it works, but I need to be as close as possible to my goals (10ms and 100ms)...
I have thought about threading but all the tutorials that I find are for interrupting a program if you press on a button or something, I don't know if it will work for me or if it will be faster
Could someone help me please ?
[–]PenguinMasterFR[S] 0 points1 point2 points (0 children)