I am trying to move my TrayMotor to a certain point according to my pot values, my solution in driver control doesn’t seem to work in the autonomous period. I tried plugging this function in autonomous and it did not stop the tray motor once it reached its position. Any help? Language: Python
if TrayPot.value(RotationUnits.DEG) < 135:
Do you have that statement wrapped in a loop? If you don’t it will be evaluated once and then the program will move on, probably never stopping the lift.
In autonomous you don’t generally have while loops. In order for this to update motor power it must be checked regularly. If you are doing something else simultaneously consider multithreading
This would be the exact purpose of a while loop.
I posted the same time you did, I wasn’t commenting on what you said.
I was just saying that often times simple autons don’t work around loop,s but if you use PID you’d need them.