View Single Post
  #10   Spotlight this post!  
Unread 13-03-2012, 00:12
KeyFalcon KeyFalcon is offline
Registered User
FRC #4185 (Fanastic Falcons)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Fairfield
Posts: 5
KeyFalcon is an unknown quantity at this point
Re: Joystick Trigger and Button C++ Programming

Like this?
Code:
void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(rightstick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
			//pressing 6 will turn on intake, releasing 6 will stop intake
			if(rightstick->GetRawButton(6) == 1)
			{
			     Intakevictor->Set(.7f);
			}
			else if(rightstick->GetRawButton(6) == 0)
			{
			     Intakevictor->Set(0.0f);
			}
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
Or Like this
Code:
void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(rightstick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
		//pressing 6 will turn on intake, releasing 6 will stop intake
					if(rightstick->GetRawButton(6) == 1)
					{
					     Intakevictor->Set(.7f);
					}
					else if(rightstick->GetRawButton(6) == 0)
					{
					     Intakevictor->Set(0.0f);
					}
	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote