本文整理汇总了C++中Encoder::StartLiveWindowMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Encoder::StartLiveWindowMode方法的具体用法?C++ Encoder::StartLiveWindowMode怎么用?C++ Encoder::StartLiveWindowMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encoder
的用法示例。
在下文中一共展示了Encoder::StartLiveWindowMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OperatorControl
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
LifterEncoder.StartLiveWindowMode();
LifterEncoder.Reset();
while (IsOperatorControl() && IsEnabled()) {
// Set the motor controller's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
// lifterA_motor.Set(joy.GetY());
// lifterB_motor.Set(joy.GetY());
if ( stick.GetRawButton(1))
{
}
else if (stick.GetRawButton(2))
{
}
else if (stick.GetRawButton(3))
{
// Elevator down
if (BottomLimitSwitch.Get() == 0) {
lifterA_motor.Set(0.5);
lifterB_motor.Set(0.5);
} else {
lifterA_motor.Set(0);
lifterB_motor.Set(0);
}
}
else if (stick.GetRawButton(4))
{
}
else if (stick.GetRawButton(5))
{
// Elevator up
if (TopLimitSwitch.Get() == 0) {
lifterA_motor.Set(-0.5);
lifterB_motor.Set(-0.5);
} else {
lifterA_motor.Set(0);
lifterB_motor.Set(0);
}
}
else if (stick.GetRawButton(6))
{
}
else if (stick.GetRawButton(7))
{
}
else if (stick.GetRawButton(8))
{
}
else if (stick.GetRawButton(9))
{
}
else if (stick.GetRawButton(10))
{
}
else if (stick.GetRawButton(11))
{
}
else if (stick.GetRawButton(12))
{
}
else
{
lifterA_motor.Set(0.0);
lifterB_motor.Set(0.0);
}
if(BottomLimitSwitch.Get()==true)
{
LifterEncoder.Reset();
}
// Send some stuff to the dashboard
SmartDashboard::PutBoolean("Top Limit Switch", TopLimitSwitch.Get());
SmartDashboard::PutBoolean("Bottom Limit Switch", BottomLimitSwitch.Get());
SmartDashboard::PutNumber("Encoder Position",LifterEncoder.GetRaw());
Wait(kUpdatePeriod); // Wait 5ms for the next update.
}
}