本文整理汇总了C++中EGamepad::GetLeftY方法的典型用法代码示例。如果您正苦于以下问题:C++ EGamepad::GetLeftY方法的具体用法?C++ EGamepad::GetLeftY怎么用?C++ EGamepad::GetLeftY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EGamepad
的用法示例。
在下文中一共展示了EGamepad::GetLeftY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArmInputs
void HandleArmInputs(void)
{
if (gamepad.GetLeftY() < -0.1)
{
if (potentiometer.GetVoltage() < 4.5)
{
armMotor.Set(1.0);
}
else
{
armMotor.Set(0.0);
}
}
else if (gamepad.GetLeftY() > 0.1)
{
if (potentiometer.GetVoltage() > .5)
{
armMotor.Set(-1.0);
}
else
{
armMotor.Set(0.0);
}
}
else
{
armMotor.Set(0.0);
}
if (gamepad.GetEvent(BUTTON_CLAW_1_LOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_1_UNLOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kReverse);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_LOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_UNLOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kReverse);
}
}
示例2: HandleArmInputs
void HandleArmInputs(void)
{
if (!m_jogTimerRunning)
{
if (gamepad.GetLeftY() < -0.1)
{
if (potentiometer.GetVoltage() < 4.5)
{
armMotor.Set(ARM_FWD);
}
else
{
armMotor.Set(0.0);
}
}
else if (gamepad.GetLeftY() > 0.1)
{
if (potentiometer.GetVoltage() > .5)
{
armMotor.Set(ARM_REV);
}
else
{
armMotor.Set(0.0);
}
}
else if (kEventClosed == gamepad.GetDPadEvent(Gamepad::kUp))
{
armMotor.Set(ARM_FWD);
jogTimer.Start();
jogTimer.Reset();
m_jogTimerRunning = true;
}
else if (kEventClosed == gamepad.GetDPadEvent(Gamepad::kDown))
{
armMotor.Set(ARM_REV);
jogTimer.Start();
jogTimer.Reset();
m_jogTimerRunning = true;
}
else
{
armMotor.Set(0.0);
}
}
else if (jogTimer.HasPeriodPassed(JOG_TIME))
{
armMotor.Set(0);
jogTimer.Stop();
jogTimer.Reset();
m_jogTimerRunning = false;
}
if (gamepad.GetEvent(BUTTON_CLAW_1_LOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_1_UNLOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kReverse);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_LOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_UNLOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kReverse);
}
}