I cant get the servos to work the button we are using automatically goes to one as soon as the program starts. I dont know how to make it start at zero then make it go to one once I push the button. heres the program

The only problem I see with the servo now is that it likes to glitch and shake when I am holding down one of the buttons. Does anyone know how to fix this?

Josh HohneWaltrip HS Robotics

Fri Oct 29, 2010 1:20 pm

Gary Samad

Expert

Joined: Mon Mar 15, 2010 4:24 pmPosts: 124

Re: Servos

Josh, the problem is with the structure of your if statements. If one button is pressed and not the other, the motor will first be set to 63, then will be immediately set to 0. Or it will first be set to 0, then will be immediately set to -63. A better way to do it is:

Now this will work this way:Neither button pressed = motor set to 0Up button pressed, Down button not pressed = motor set to 63Up button pressed, and Down button pressed = motor set to 63Up button not pressed, Down button pressed = motor set to -63

Shouldn't jitter any more.

cu,Gary

Fri Oct 29, 2010 5:16 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: Servos

You don't even need the else servo = 0 statement. If you are not giving the servo a value, it will automatically go to zero.

_________________sudo rm -rf /

Fri Nov 05, 2010 7:53 am

Gary Samad

Expert

Joined: Mon Mar 15, 2010 4:24 pmPosts: 124

Re: Servos

magicode wrote:

You don't even need the else servo = 0 statement. If you are not giving the servo a value, it will automatically go to zero.

I presume this is happening in a loop, so it may be set to 63 when a button is pressed, then a little while later when the buttons are released, it needs to be set to 0. Once you've set it to 63 it will stay at 63 until you tell it to do something else.

cu,Gary

Fri Nov 05, 2010 11:41 am

mcarames

Rookie

Joined: Wed Jun 15, 2011 11:27 amPosts: 2

Re: Servos

Where can I find information about how to program the joy stick.Thank you.manuel

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum