While loop not functioning correctly?

Ok so basically I wrote a piece of code previously that made my lift and claw work off of potentiometers to pick-up cubes by itself. After converting to a function, I never really used it as we started having other problems (constantly breaking other sensors as a result of this motion). Now that we are coding auton and need this motion, we decided to call the function. The problem arised when the while loop refused to stop and the lift wouldn’t stop moving upwards. So, I then decided to break it down, create another lift function (only because I can now use this new function in other applications as well) and the lift part works fine. When I try to close my claw, however, the while loop running the claw never stops. I was just wondering if there was an unseen problem so I could revert back to an older version or if I just made a simple coding error. I would send my code but it’s from the beta version so I’ll send snipets if needed. This is the segment of the code being problematic.


After the while loop, you need to stop the motor. Instead of clawBreak you can just use clawLoc.value(percentUnits::pct) < 63. Also, make sure that the logic in that line is correct (Make sure it is < and not >)

1 Like

Yea I just added clawBreak because it wasn’t working with the regular statement. But will try stopping the motor, thanks!