View Single Post
  #4   Spotlight this post!  
Unread 07-02-2012, 21:34
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: How to use tasks

Code:
class 4174robot : public IterativeRobot
{
public:
...(Interative Robot Overrides)...
    Task *task1;
 
    4174robot();
    ~4174robot();
 
...
};
 
static void TestTaskFunction(void)
{
    std::cout<<"task has been started"<<endl;
}
 
4174robot::4174robot()
{
    task1 = new Task("testtask", (VOIDFUNCPTR) TestTaskFunction);
}
 
4174robot::~4174robot()
{
    delete task1;
}
...
4174robot::Teleopinit()
{
    task1->Start();
}
...
Disabledinit()
{
    task1->Stop();
}
Note that once you enabled TeleOp, it will print the line "task has been started" and the task will end.
__________________

Last edited by mikets : 07-02-2012 at 22:17.
Reply With Quote