View Single Post
  #7   Spotlight this post!  
Unread 04-04-2010, 23:28
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Ternary operators

Quote:
Originally Posted by Robototes2412 View Post
@Radical Pi: Yay, can you post some memorable examples of using them?
This one got me messed up a few times

Code:
kickerJag->Set(jr->GetTrigger() || dsio->GetDigital(11) ? 0.0 : dsio->GetAnalogInRatio(1));
Explanation: We use a rotating kicker mounted on pneumatic sliders with a clutch so that we can spin it inside the robot then slide it out to kick. If the trigger on the right joystick or the big red kick button is pressed, then disable the spinner motor (no reason to leave it spinning freely). If neither button is pressed (kicker retracted), then set the speed to the value of a potentiometer on the DS.
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"