mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
32 lines
881 B
C++
32 lines
881 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 <frc/Joystick.h>
|
|
#include <frc/PWMSparkMax.h>
|
|
#include <frc/TimedRobot.h>
|
|
#include <frc/drive/DifferentialDrive.h>
|
|
|
|
/**
|
|
* This is a demo program showing the use of the DifferentialDrive class.
|
|
* Runs the motors with arcade steering.
|
|
*/
|
|
class Robot : public frc::TimedRobot {
|
|
frc::PWMSparkMax m_leftMotor{0};
|
|
frc::PWMSparkMax m_rightMotor{1};
|
|
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
|
frc::Joystick m_stick{0};
|
|
|
|
public:
|
|
void TeleopPeriodic() override {
|
|
// Drive with arcade style
|
|
m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX());
|
|
}
|
|
};
|
|
|
|
#ifndef RUNNING_FRC_TESTS
|
|
int main() {
|
|
return frc::StartRobot<Robot>();
|
|
}
|
|
#endif
|