I would of sent this to the programming forum however i need some technical advice on hardware before I move on to the programming side.
I have a linear servo located here: http://www.servocity.com/html/heavy_duty_linear_servo__180__.html#.VGAH6PTF8kg
I've read articles where I need to constantly be sending a PWM signal to the linear servo in order to maintain the desired output "position in my case". However, these servos are position oriented not speed oriented like several articles refer too. So my first question is, do I need my PWM pin on my MCU to send a PWM signal to the servo constantly to keep/maintain a position? Also I have been currently using digitalread() to read the status of a push button which then triggers a PWM pin to send the pwm signal. It looks like this "if (digitalread(button) == pressed){send pwm signal}. When I do this I notice some awkward behavior. For example, when I push the button the first time the servo arm goes out about an inch then stops almost like it didn't receive the full signal. When I press the button again it goes all the way out like its suppose to.
Second question depends on the above answer. I would like to know how to structure my program. If I need to constantly be sending a signal then the following seems appropriate.
while(button == pressed)
{
digitalwrite(pwmSignal);
}
while(button == notpressed)
{
do nothing
}
However, I would think once one condition is satisfied it would stay in the loop and not exit or maybe not. Also it would be nice to just have to press the button once and not have to hold down on it. Really could use some help on the more efficient/effective way to do this. I should also note I do have push buttons and toggle switches so the toggle switches would work great if I need to constantly have the switch in the on position. The push buttons will just read high when I press it down after that it returns low.
Now if I don't need to constantly be sending a pwm signal then I could do the following which is what i've been doing. However, I experience some awkward behavior like what I mentioned above where the servo arm extends an inch and stops instead of going all the way out like its suppose to.
if(button == pressed)
{
digitalwrite(pwmSignal)
}
if(button == not pressed)
{
do nothing
}
Therefore, I could use your help clearing up the confusion i'm having with the servo itself and with the programming structure.