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

Setting Motor Speed
http://www.robotc.net/forums/viewtopic.php?f=52&t=995
Page 1 of 1

Author:  Sellers3143 [ Thu Dec 04, 2008 12:29 pm ]
Post subject:  Setting Motor Speed

How do you control the motor speed on motors with the joystick controlling it. I have the code right here but where do I add in my power at?
Code:
   
    getJoystickSettings(joystick);
    motor[motorD] = joystick.joy2_y1;
    motor[motorE] = joystick.joy2_y1;

Author:  tfriez [ Thu Dec 04, 2008 3:57 pm ]
Post subject:  Re: Setting Motor Speed

You code currently has the second configured joystick driving both of your motors with it's left y-axis... I don't think this is what you want.

Code:
    getJoystickSettings(joystick);
    motor[motorD] = joystick.joy1_y1;
    motor[motorE] = joystick.joy1_y2;


Will give you more like "tank control" behavior. The power levels come from the joystick positions (0=center,-127=bottom,+127=top). Positive values move your motors forward, negative values more your motors in reverse.

Author:  Sellers3143 [ Thu Dec 04, 2008 5:26 pm ]
Post subject:  Re: Setting Motor Speed

The reason I have this set to where i control both motors with one button is because this is for the puck getting device that we will be using. We are using the motors at once and we want them to be on the same time track but what i need to do is slow the motors down to where the max speed they can go is 50.

Author:  10nisman94 [ Thu Dec 04, 2008 5:32 pm ]
Post subject:  Re: Setting Motor Speed

Quote:
Code:
getJoystickSettings(joystick);
motor[motorD] = joystick.joy1_y1 * 0.4;
motor[motorE] = joystick.joy1_y2 * 0.4;


This will set the max speed at like 52ish

Author:  Sellers3143 [ Thu Dec 04, 2008 6:01 pm ]
Post subject:  Re: Setting Motor Speed

Alright works great thanks for the help.

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