|
Re: Operator Control Help
Everything that has been said here so far is good advice. A couple extra points:
1. While 127 is "true" neutral for a PWM, there is a dead band where the motors won't respond. This depends on the motor attached to that PWM and the load attached to the motor, so you have to test your code on the completed mechanisms.
2. As for your "press to extend, release to retract" idea, you need to monitor the trigger for a state change. For example, this snippet should work for what you suggest:
if(trigger == 1){
if(last_trigger == 1){
//remain extended
}
else{
//extend
}
}
else{
if(last_trigger == 1){
//retract
}
else{
//remain retracted
}
}
Something along those lines would work for your trigger. Keep in mind that the user becomes involved too. If that finger slips, even for an instant, the retraction will occur. It may be possible to stop and reverse that action, but if it is absolutely necessary to keep the pneumatic extended, a switch is the way to go.
-JEE
|