Neither time did it twitch.
I modified the code because you were using myrobot when it didn't exist.
Code:
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
class Robot: public SampleRobot
{
Joystick stick; // left joystick
Joystick stick2; //right joystick
Talon left1;
Talon left2;
Talon right1;
Talon right2;
public:
Robot() :
stick(0),
stick2(1),
left1(4),
left2(5),
right1(6),
right2(7)
{
left1.SetExpiration(0.1);
left2.SetExpiration(0.1);
right1.SetExpiration(0.1);
right2.SetExpiration(0.1);
}
void RobotInit()
{
}
void Autonomous()
{
left1.Set(0.0);
left2.Set(0.0);
right1.Set(0.0);
right2.Set(0.0);
}
void OperatorControl()
{
left1.SetSafetyEnabled(true);
left2.SetSafetyEnabled(true);
right1.SetSafetyEnabled(true);
right2.SetSafetyEnabled(true);
while (IsOperatorControl() && IsEnabled())
{
left1.Set(stick.GetY());
left2.Set(stick2.GetY());
right1.Set(-stick2.GetY());
right2.Set(-stick2.GetY());
Wait(0.005);
}
}
void Test()
{
}
};
START_ROBOT_CLASS(Robot)