|
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.
|