View Single Post
  #4   Spotlight this post!  
Unread 13-02-2015, 11:01
Rakusan2 Rakusan2 is offline
Registered User
AKA: Tomas Rakusan
FRC #3571 (Milton Mustangs)
Team Role: Programmer
 
Join Date: May 2014
Rookie Year: 2011
Location: Milton, ON, Canada
Posts: 22
Rakusan2 is an unknown quantity at this point
Re: Pneumatics, getting XBox input

This is something my team is using
Code:
if (DriverButtons.X.changedDown)
{
	
	if (HighGear)
	{
		Shifter.set(Value.kReverse);
	} else {
		Shifter.set(Value.kForward);
	}
	HighGear=!HighGear;
}
That involves our own code for the XboxControler which detects if it has changed state this run and consists of compering the last state with the current,
but if do not want a toggle then you can easily do
Code:
		if (DriverButtons.X.current)
		{
			pistonArm.set(Value.kReverse);
		}
		else {
			pistonArm.set(Value.kForward);
		}
And do not forget to change DriverButtons.X.current to your own code that gets the current value of your button
Reply With Quote