View Single Post
  #5   Spotlight this post!  
Unread 12-01-2008, 20:51
jee7s jee7s is offline
Texan FIRSTer, ex-frc2789, ex-frc41
AKA: Jeffrey Erickson
FRC #6357
 
Join Date: Nov 2007
Rookie Year: 1997
Location: Dripping Springs, TX
Posts: 315
jee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond repute
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