NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
alternating_tasks.nxc

This is an example of how to use the ExitTo function.

// When run, this program alternates between task A and task B until halted
// by pressing the gray button.
task B();
void beep(const int tone)
{
PlayTone(tone, MS_500);
}
task A()
{
beep(TONE_C4);
ExitTo(B);
}
task B()
{
beep(TONE_C6);
ExitTo(A);
}
task main()
{
// ExitTo(B) would work as well here.
}