|
| 1 | +/*----------------------------------------------------------------------------*/ |
| 2 | +/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ |
| 3 | +/* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 4 | +/* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | +/* the project. */ |
| 6 | +/*----------------------------------------------------------------------------*/ |
| 7 | + |
| 8 | +#include <frc/Joystick.h> |
| 9 | +#include <frc/TimedRobot.h> |
| 10 | +#include <frc/drive/DifferentialDrive.h> |
| 11 | + |
| 12 | +#include "frc/WPILib.h" |
| 13 | +#include "ctre/Phoenix.h" |
| 14 | + |
| 15 | +/** |
| 16 | + * This is a demo program showing the use of the DifferentialDrive class. |
| 17 | + * Runs the motors with arcade steering. |
| 18 | + */ |
| 19 | +class Robot : public frc::TimedRobot { |
| 20 | + WPI_VictorSPX * rightFront = new WPI_VictorSPX(3);//ID needs to be set |
| 21 | + WPI_VictorSPX * leftFront = new WPI_VictorSPX(4);//ID needs to be set |
| 22 | + WPI_VictorSPX * rightBack = new WPI_VictorSPX(5);//ID needs to be set |
| 23 | + WPI_VictorSPX * leftBack = new WPI_VictorSPX(6);//ID needs to be set |
| 24 | + rightBack -> Follow(rightFront::PercentOutput); |
| 25 | + frc::DifferentialDrive m_robotDrive{*rightFront, *leftFront}; |
| 26 | + frc::Joystick m_stick{0}; |
| 27 | + |
| 28 | + public: |
| 29 | + void TeleopPeriodic() { |
| 30 | + // Drive with arcade style |
| 31 | + m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX()); |
| 32 | + } |
| 33 | +}; |
| 34 | + |
| 35 | +#ifndef RUNNING_FRC_TESTS |
| 36 | +int main() { return frc::StartRobot<Robot>(); } |
| 37 | +#endif |
0 commit comments