|
Re: Need help in creating program to use servo's to shift drive
Posted by Matt Starkey at 2/10/2001 3:12 PM EST
Engineer on team #236, Techno Ticks, from Lyme/Old-Lyme High School and Millstone Power Station.
In Reply to: Re: Need help in creating program to use servo's to shift drive
Posted by Barry Horwitz on 2/10/2001 11:27 AM EST:
: : My building team developed a drive assembly that has a servo attached to the drive motor shifter. This will assembly will to shift from low to high gears. I am trying to control the shifting only when the joysticks are in dead stick position. I have the drive motors as PWM1 & 2. The servos are PWM 3 & 4. The trigger on joystick one controls the servos. The program now allows shifting all the time. I have tried to put conditional statements in the subroutine section and in the PWM limit switch control area. HELP!!!
: : I need to put a statement in the program that will only allow the trigger to move PWM3&4 when the joystick is in dead stick position. Where in the program should this go and what might it look like?
: :Barry
You can put some conditional statements anywhere you want to as long as they are inside the main loop. Try using a series of "IF" statements if you are not too concearned with the loop time changing on you depending on the conditions.
1) is the trigger pulled? (assuming that the trigger is input that changes the position of the servo's). if not skip the rest of the routine.
2) if so, are the drive motors standing still (both equal to 127). If not, skip the rest of the routine.
3) if so, move the servo to the new position.
Servo position will have to be stored between loops and a statement somewhere in the code (outside of the conditional statements) to set servo position to stored position each loop.
Hope this helps -- Didn't want to give it away, but would be happy to answer any more questions.
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|