View unanswered posts | View active topics It is currently Thu Dec 18, 2014 1:25 pm






Reply to topic  [ 3 posts ] 
Programming an Emergency Shutdown 
Author Message
Rookie

Joined: Mon Aug 25, 2014 10:48 pm
Posts: 1
Post Programming an Emergency Shutdown
I need to program a conveyor belt that can be shut down while it is going through the code. From what I understand, I can't use a while loop or an if-else statement because both of these only check for a change in their condition once each time the robot performs its program. I need to use a code that will continuously check for a change in the conditions as it performs the main code. How would I go about doing this?


Mon Aug 25, 2014 10:59 pm
Profile
Rookie

Joined: Thu Dec 01, 2011 12:07 am
Posts: 45
Post Re: Programming an Emergency Shutdown
Try something like this...

conveyor_motor = ON
WHILE conveyor_motor = ON
IF stop_button = true
conveyor_motor = OFF
ENDIF
ENDWHILE
do stuff with conveyor stopped


Tue Aug 26, 2014 8:39 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 619
Post Re: Programming an Emergency Shutdown
This is one of those rare instances (at least in this level of programming) where multitasking is a valid, efficient option. You can see a brief overview of ROBOTC's multitasking implementation here (along with a rough psuedocode of the emergency stop button implementation) and an overview of all of the ROBOTC for Cortex multitasking commands here.

You can also find an overview of the Task Status debugger window here (useful to keep track of which tasks are being run any at any point in your program).

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Aug 27, 2014 9:38 am
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.