Team programs claw to close and stay closed by pressing button 5U. Is there a way to have button 5D break a while loop and open the claw and keep it open without having a clean break. Team has tried and it seems like the motors on the claw stop working.
Claw is closed motor at 127
Claw is open motor at -127
What I am wondering is if when 5d is pressed is it switching the motor or is the motor trying to go both ways. This is just a psuedo code not the actual code.
The motor will always try and run at the last commanded value, so no, you will not try and make it go both ways at once. If the motor stalls (stops moving) when you are sending a large command value (>90) then the motor will trip its internal thermal protection PTC in about 5 seconds, that’s probably what you are seeing. To hold the claw closed you should send a much smaller control value, perhaps 25 would work. So the code would be something like this (in pseudo code form)
if button 5U pressed then
motor = 127
wait 3 seconds (or whatever is needed to close the claw)
while button 5U pressed
motor = 25
You can make that more intelligent by using a timer so you do not have a fixed 3 second wait.