Thread: Timer class
View Single Post
  #1   Spotlight this post!  
Unread 12-09-2011, 17:03
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
Red face Timer class

Hi, I have a problem, I use wait to time the motors on our robot, but then we ran into a problem where we would lose control of the robot untill it has finished the wait sequence. I have tried putting "myRobot->Drive(leftstick, rightstick)" in the function but we still would lose control. So I heard that I can use the Timer.h class to substitute for wait, I have tried this code on our bench top set up on a different cRio but it would jus run the motor non stop, when I disable it then enable, the motor starts running again. Can someone help me please?

Code:
class RobotDemo : public SimpleRobot

Timer *time;

public:

time->Reset():

Tele-op:

if (ArmStick.GetRawButton(11))
{
      time->Start();
      Carriage_motor->Set(1.0);
      if (time->Get() >= 60)
      {
         Carriage_motor->Set(0.0);
      }
}
Reply With Quote