I need to make a motor run for an amount of time, sleep for an amount of time, then repeat making an infinite loop
from adafruit_motorkit import MotorKit
import time
kit = MotorKit()
while True:
endtime = time.time() + 60 # runs motor for 60 seconds
while time.time() < endtime:
kit.motor1.throttle = 1
pass
print('endtime passed')
time.sleep(10)
print('done sleeping')
I'm expecting the motor to run for a minute, give the endtime passed
message, and sleep for 10 seconds, but the motor never sleeps. I'm new to python so I don't know much about this and any help is appreciated.