View unanswered posts | View active topics It is currently Sat Nov 22, 2014 7:35 am






Reply to topic  [ 3 posts ] 
Kill Switch. Help now. due in 1 hour. 
Author Message
Rookie

Joined: Thu Dec 06, 2012 4:31 pm
Posts: 1
Post Kill Switch. Help now. due in 1 hour.
I need a code for code switch for two motor's and three line followers and a ultrasonic sensor. I need to be be able to press a bum switch to stop everything, like a kill switch, however the StopAllTasks doesn't work because there is one task(main).

It is fine if the reply is late. I just want to know.


Thu Jan 17, 2013 5:00 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Kill Switch. Help now. due in 1 hour.
Just for future reference, posting things like "Help Now. Due in 1 hour" doesn't come across as too nice.

As for your code, here's one way to do it:

Code:
task StopEverything(){
  while(true){
    if(button is pressed){
      StopAllTasks();
    }
    Wait1MSec(1);
  }
}

task main(){
  StartTask(StopEverything);
  //rest of your code
}

_________________
sudo rm -rf /


Thu Jan 17, 2013 5:07 pm
Profile
Novice
User avatar

Joined: Sat Jul 10, 2010 3:06 pm
Posts: 86
Location: Roanoke, VA
Post Re: Kill Switch. Help now. due in 1 hour.
magicode wrote:
Just for future reference, posting things like "Help Now. Due in 1 hour" doesn't come across as too nice.

QFT. In fact, it makes some people (like me), who are typically helpful, wait for an hour before posting...

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Twitter: @RoboDesigners


Thu Jan 17, 2013 7:45 pm
Profile WWW
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.