View Single Post
  #5   Spotlight this post!  
Unread 23-01-2011, 19:22
DiscoKittyPrime DiscoKittyPrime is offline
Registered User
AKA: Joshua Bryant
FRC #0057 (Leopards)
Team Role: Programmer
 
Join Date: Dec 2010
Rookie Year: 2003
Location: Houston, Tx
Posts: 26
DiscoKittyPrime will become famous soon enough
Re: Button programin C++

Try this:

if ( !stick.GetTrigger()){
motors.Set(x);
}
else{
motors.Set(x/2);
}

This code assumes that x is the input variable that you use for speed. For driver control, this would be the value you get from your joysticks. It works by checking to see if the trigger is pressed. If not, then the speed is just as normal. If the trigger is pressed, then the speed is half of what it would normally be. Hope this is what you meant.
Reply With Quote