View unanswered posts | View active topics It is currently Mon Jul 14, 2014 2:24 am






Reply to topic  [ 5 posts ] 
Setting Motor Speed 
Author Message
Rookie

Joined: Tue Dec 02, 2008 12:40 pm
Posts: 9
Post 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;


Thu Dec 04, 2008 12:29 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 601
Post 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.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Thu Dec 04, 2008 3:57 pm
Profile
Rookie

Joined: Tue Dec 02, 2008 12:40 pm
Posts: 9
Post 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.


Thu Dec 04, 2008 5:26 pm
Profile
Novice

Joined: Mon Oct 13, 2008 6:29 pm
Posts: 75
Location: Florida, USA
Post 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

_________________
PHUHS Robotics
Team 516 FTW

Daytona Robofest Winning Alliance Captain
Daytona Robofest Inspire Award


Thu Dec 04, 2008 5:32 pm
Profile
Rookie

Joined: Tue Dec 02, 2008 12:40 pm
Posts: 9
Post Re: Setting Motor Speed
Alright works great thanks for the help.


Thu Dec 04, 2008 6:01 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.