View Single Post
  #8   Spotlight this post!  
Unread 23-01-2011, 19:41
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++

If your joystick's name in the program is "hand" then the portion of the code that needs to be the argument for the if statement is as follows: "hang.GetTrigger()".

The code segment would look like

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

You don't need a boolean variable for this code, only the value coming directly from the joystick.
Reply With Quote