Quote:
Originally Posted by Robobuff1.0
Okay here is a picture of my code. So is it correct? I want the motor to go to the encoder position and hold.
|
Since you have reset the encoder, it will start out at zero, and you are giving a positive power, so the encoder value will go up.
Which means that test: Encoder > -360 will be true immediately, so the loop will exit immediately. So perhaps it should be > 360.
Some suggestions....
You really should have a "wait" in that loop because once it starts working, it will lock up the program for the duration of the arm move (which may not be a good idea) You should maybe wait for 25 to 50 msec.
Also., once the loop exits, if you don't send a new motor command in 2.5 seconds, it will droop down again.
FTC used to have a "move to position" (rather than "Move fixed distance")which would do exactly what you want here, with a single call, but I couldn't find it this year (had to roll my own).
Phil.