Files
allwpilib/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/cpp/subsystems/Intake.cpp

20 lines
644 B
C++

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "subsystems/Intake.hpp"
wpi::cmd::CommandPtr Intake::IntakeCommand() {
return RunOnce([this] { m_piston.Set(wpi::DoubleSolenoid::FORWARD); })
.AndThen(Run([this] { m_motor.SetDutyCycle(1.0); }))
.WithName("Intake");
}
wpi::cmd::CommandPtr Intake::RetractCommand() {
return RunOnce([this] {
m_motor.Disable();
m_piston.Set(wpi::DoubleSolenoid::REVERSE);
})
.WithName("Retract");
}