View unanswered posts | View active topics It is currently Wed Aug 20, 2014 7:29 pm






Reply to topic  [ 2 posts ] 
NXT motor speed on Joystick 
Author Message
Rookie

Joined: Tue Jan 26, 2010 4:46 pm
Posts: 2
Post NXT motor speed on Joystick
I am wanting to use the joystick control for two NXT motors. I currently have them set up so they run speed on Y1 and directon on Y2; but the speed is too quick. I used the sample joystick tank drive program and modified it. I don't understand the logic behind...so I am just not getting it to work like I want it too. I tried making the motors just run at 25% speed, but then they didn't have joystick control anymore and were always on.

Here is my current code for that function:

//trying to use tank drive to work claw

nClawPower = joystick.joy2_y1;
nClawDirection = joystick.joy2_y2;
if (nClawDirection < 0)
{
// Turn claw open

motor[TopClaw] = nClawPower; // use power settings from Y-axis
motor[BotClaw] = nClawPower * (64 + nClawDirection) / 64;
}
else
{
// Turn claw shut

motor[TopClaw] = nClawPower; // use power settings from Y-axis
motor[BotClaw] = nClawPower * (64 - nClawDirection) / 64;


Any suggestions would be greatly appreciated!


Tue Jan 26, 2010 4:57 pm
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: NXT motor speed on Joystick
Take the joystick value and multiply it by a fraction such as *33/100. That way is is stll variable but slower.

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Fri Jan 29, 2010 2:01 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 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:  



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