|
Re: Servo Programming Again.....
I can see a potential run time error in your code. You want to set up one conditional block which handles everything instead of the two. With the two blocks, the output of the first block will always be overwritten by the second.
Something like
if (Trigger == 1)
pwm15 = 255
else if (Top == 1)
pwm15 = 0
else
pwm15 = 127
Thats really pseudo code, so you need to replace the variables with your own. The logics behind it is what is important.
To answer your question, no. The servo will not remain in that position if the the trigger is released. You need to set up a variable that is set to a value when the trigger is pressed and that variable will then be checked in the conditionals.
Two years ago, I set up an auto targeting system that was engaged by the trigger on the joystick. We set a variable to a number then multiplied it by -1 if the trigger was depressed. The conditional would then check to see if the variable was greater or less than 0 which would determine the status of the system (On or Off). Similarly, you could try something for your problem. Feel free to PM for more info.
__________________
Mentor
BS Information Technology - NJIT (2009 - )
Team 869 (2004 - 2008, 2011 -), Team 1811 (2010), Team 869 (2009), Team 613 (2009 - 2010)
"Nothing in this life worth having comes easy."
|