View unanswered posts | View active topics It is currently Tue Sep 29, 2020 1:50 pm






Reply to topic  [ 3 posts ] 
task doesn't work at all!!! 
Author Message
Rookie

Joined: Fri May 22, 2009 2:44 am
Posts: 2
Post task doesn't work at all!!!
Hi, I've just started NXT programming.
Reading instructions, I programmed a task to move forward.

Code:
task goStraight(){
            motor[LeftM]=-90;
            motor[RightM]=-90*MOTOR_STRAIGHT_CORRECTION;
            wait1Msec(time);
}

task main()
{
            StartTask(goStraight);
}


and it didn't work at all!!!!

(※MOTOR_STRAIGHT_CORRECTION is a constant value)

Well, it did work when I programmed :

Code:
task main()
{
            motor[LeftM]=-90;
            motor[RightM]=-90*MOTOR_STRAIGHT_CORRECTION;
            wait1Msec(1000);
}


then, what's the problem?
I need your help.


Tue Aug 18, 2009 3:19 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: task doesn't work at all!!!
Your program exits as soon as the main task exits. That means you need to change your program to:

Code:
task goStraight(){
  motor[LeftM]=-90;
  motor[RightM]=-90*MOTOR_STRAIGHT_CORRECTION;
  wait1Msec(time);
}

task main()
{
  StartTask(goStraight);
  // The next line stops the main task from exiting.
  while (true) { wait1Msec(10); }
}


Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Aug 18, 2009 3:39 am
Profile WWW
Rookie

Joined: Fri May 22, 2009 2:44 am
Posts: 2
Post Re: task doesn't work at all!!!
thx a lot!!!
It works very well!!


Tue Aug 18, 2009 8:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.