Log in

View Full Version : Servo responding to button


inkspell4
01-02-2012, 21:09
Well my team wants to use the camera pan and tilt assembly to respond to the bottoms on the top of the joystick could someone help I don't know we're to start everything I have tried has not worked

Alan Anderson
02-02-2012, 00:02
Can you rephrase that? It sounds very confusing. And what exactly do you mean by "respond to"?

inkspell4
02-02-2012, 06:34
If a button is pressed the camera on the servo moves up one degree or so

Alan Anderson
02-02-2012, 08:15
So in order to move the camera up ten degrees, you would have to press the button ten times? If you want to be able to hold the button down for continuous motion, how quickly (degrees per second) do you want the camera to move? Do you ever want to move the camera down? You mentioned the pan and tilt assembly; do you also want to be able to move the camera from side to side?

I'll assume you want to control a pair of servos with two pairs of buttons, one button each for up, down, left, and right. Is that correct? If so, which buttons do you want to use?

inkspell4
02-02-2012, 09:02
i was thinking of something like

void operatorcontrol()
{
while(isOperatorControl)
{
double degree;
if(button is pressed)
{
degree incremented up
}
update servo
}
...

do you have code that works for a joystick button and code that works for a servo
if so could you post it
or even if you have the exact code we need

even if you do not any help will be appreciated


THANKS

Also the Previous assumption is correct

Alan Anderson
02-02-2012, 11:09
If you don't answer the specific questions, I can't give you any specific advice.

Do you know how to read the value of a joystick button?

Do you know how to set the angle of a servo?

Do you know how to use static variables to remember a value between runs of a function?

inkspell4
02-02-2012, 11:11
If you don't answer the specific questions, I can't give you any specific advice.

Do you know how to read the value of a joystick button?

Do you know how to set the angle of a servo?

Do you know how to use static variables to remember a value between runs of a function?

Question 1: Yes
Question 2: Not really
Question 3: Why but not really