Try something like this:
Code:
#include "WPILib.h"
class Robot: public SampleRobot
{
Talon Motor;
DigitalInput limitSwitch;
public:
Robot():
limitSwitch(1),
Motor(6)
{
}
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
if(limitSwitch.Get()) {
Motor.Set(1.0);
Wait(0.005);
}
}
}
};
START_ROBOT_CLASS(Robot);
limitSwitch.Get() returns a boolean (true if the limit switch is pressed, false if it isn't). If you want it to move when the limit switch is pressed, then you want to move when the get method is returning true.