ROBOTC.net forums
http://robotc.net/forums/

Servos
http://robotc.net/forums/viewtopic.php?f=53&t=2679
Page 1 of 1

Author:  crazzyasian08 [ Thu Oct 21, 2010 5:07 pm ]
Post subject:  Servos

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

dave = vexRT[btn6U];

if ((dave) == 1)
{
motor(servo1) = 172;
}
else
{
motor(servo1) = 255;
}

Author:  jbflot [ Thu Oct 21, 2010 5:13 pm ]
Post subject:  Re: Servos

Are you using ROBOTC 2.30? All of the buttons on the VEXnet Joysticks should start out at 0.

Servo values range from -127 to 127.

Also, you could just check if the button is equal to 0, instead of 1.

Author:  Hohh21 [ Fri Oct 29, 2010 1:20 pm ]
Post subject:  Re: Servos

Here is a program that I used to get some servos working. Make sure u change the MotorName to the name of your servo.


if(vexRT[Btn6U] == 1)
{
motor[MotorName] = 63;
}
else
{
motor[MotorName] = 0;
}
if(vexRT[Btn6D] == 1)
{
motor[MotorName] = -63;
}
else
{
motor[MotorName] = 0;
}


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 Hohne
Waltrip HS Robotics

Author:  Gary Samad [ Fri Oct 29, 2010 5:16 pm ]
Post subject:  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:

Code:
if(vexRT[Btn6U] == 1)
{
  motor[MotorName] = 63;
}
else if(vexRT[Btn6D] == 1)
{
  motor[MotorName] = -63;
}
else
{
  motor[MotorName] = 0;
}


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

Shouldn't jitter any more.

cu,
Gary

Author:  magicode [ Fri Nov 05, 2010 7:53 am ]
Post subject:  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.

Author:  Gary Samad [ Fri Nov 05, 2010 11:41 am ]
Post subject:  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

Author:  mcarames [ Wed Jun 15, 2011 11:41 am ]
Post subject:  Re: Servos

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

Author:  jbflot [ Wed Jun 15, 2011 11:55 am ]
Post subject:  Re: Servos

http://www.education.rec.ri.cmu.edu/pro ... index.html

Try here, in the remote control section.

Author:  mcarames [ Wed Jun 15, 2011 11:57 am ]
Post subject:  Re: Servos

jbflot wrote:
http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/index.html

Try here, in the remote control section.

Thank you.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/