dave dave - 1 month ago 9
Python Question

Python scribbler, making my robot go in a circle X secs

I am trying to make my robot go in a circle for x seconds. This is what I have:

def circle():
for t in timer(4.54):
motors(1,0)
circle()

def main():
circle()

main()


But it does not stop at 4.54 seconds, it just keeps on going. Please help, Thank you

Answer

Trying to interpret @martineau's comment, try:

def circle():
    for t in timer(4.54):
        motors(1,0)
def main():
    circle()
main()

If that doesn't work, check the following two points (guesses at the problem without knowledge of your robot's OS:

  • How long the function motors() runs for

  • Whether timer(4.54) runs for 4.54 seconds or 4.54 minutes, hours, or some other unit of time

Comments