View Single Post
  #6   Spotlight this post!  
Unread 01-28-2016, 12:07 AM
kylelanman's Avatar
kylelanman kylelanman is offline
Programming Mentor
AKA: Kyle
FRC #2481 (Roboteers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Tremont Il
Posts: 185
kylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to all
Re: Multiple timer objects / deleted timers

In addition to Joe's point the constructor will only be called once. With that in mind you will likely need to move the following out of the constructor and into the initialize method.

timer->Reset();
timer->Start();
...
isDone = false;

This will cause them to execute each time the command is ran instead of just once when the robot is started up.

In this particular case (assuming your comments are correct) your command will only run once because isDone will already be true on subsequent executions of the command. The timer will likely also not behave as you expect if you don't reset and restart it in initialize.
__________________
"May the coms be with you"

Is this a "programming error" or a "programmer error"?

Reply With Quote