View Single Post
  #3   Spotlight this post!  
Unread 19-02-2012, 21:19
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Dividing Speed on Robot Drive

You should have a scaleFactor variable and have the buttons modify it.
Code:
bool j1Btn1 = J_stick1->GetRawButton(1);
bool j2Btn1 = J_stick2->GetRawButton(1);
float scaleFactor = 1.0;
if (j1Btn1 && j2Btn1)
{
    scaleFactor = 0.25;
}
else if (j1Btn1)
{
    scaleFactor = 0.5;
}
else if (j2Btn1)
{
    scaleFactor = 0.75;
}
 
R_myRobot.TankDrive(J_stick1->GetY()*scaleFactor, J_stick2->GetY()*scaleFactor);
__________________
Reply With Quote