Python Code- motor.spin doesn't work in autonomous

motor.spin doesn’t work in autonomous
We are working on the program today and found that in autonomous mode, all the commands that make the motors run do not work, but the pneumatics work fine. In driver control, everything works normally. We used breakpoints and output to confirm that all the code is being executed. Could it be that this part of the python code works differently from C++? Should I use C++ instead of python to write the code?

It would be incredibly helpful if you could post your code as without seeing it, we can only make guesses as to the problem. A possible problem could be that you don’t have a variable controlling the motors and telling them when to stop. Without such a variable the motors will not spin because they are being constantly told to stop as their assigned control is not being pressed. Here’s an example:

           #somewhere above set example_variable to false
            if controller_1.buttonUp.pressing():
                motor.spin(FORWARD)
                example_variable = False
            elif controller_1.buttonDown.pressing():
                motor.spin(REVERSE)
                example_variable = False
            elif not example_variable:
                motor.stop()
                example_variable = True

This may not be the problem, again, without seeing the code we can only guess.

  • 11865A

You should post your code. Any time you have a code question, post the code

Thank you for the suggestions. Code posted below.

Only part of your code got uploaded.

You are using Python, just cut and paste the entire program, including any auto generated region into a post between code tags.
[code]
and
[/code]