Skip to content

Instantly share code, notes, and snippets.

@Michael0x2a
Created December 16, 2013 21:24
Show Gist options
  • Save Michael0x2a/7994689 to your computer and use it in GitHub Desktop.
Save Michael0x2a/7994689 to your computer and use it in GitHub Desktop.
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
private:
RobotDrive myRobot;
Joystick stick;
public:
RobotDemo(void):
myRobot(1, 2),
stick(1)
{
myRobot.SetExpiration(0.1);
}
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
Wait(2.0);
myRobot.Drive(0.0, 0.0);
}
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.ArcadeDrive(stick);
Wait(0.005);
}
}
void Test(void)
{
}
};
START_ROBOT_CLASS(RobotDemo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment