psr_21-22
psr_21-22 copied to clipboard
Python If statement
Good night,
Is that any way to set and "if condition" true for x amount of time? I've tried lots of options included time.sleep (that didn't work because put lot of lag in the video) and also some timers to calculate the elapsed time but also failed. Do you know if there is another way of doing this?
Thanks
Hi @josepedropinto-pt ,
not exactly sure what you mean. If you have a timer like the tic toc we used, just do
start_time = tic()
while True:
ellapsed_time = tic() - start_time
if ellapsed_time < x:
# do stuff