View Single Post
  #17   Spotlight this post!  
Unread 06-04-2003, 00:34
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
I digress.

Switches can be an effective way to implement autonomous mode if you are storing your multiple autonomous programs in multiple program slots. This is how we do it:

Code:
auto_selection 	             VAR tempvar3
	auto_select           VAR auto_selection.nib0
	auto_bit1	             VAR auto_selection.bit0
	auto_bit2	             VAR auto_selection.bit1
	auto_bit3	             VAR auto_selection.bit2


if active_button = 1 then
	auto_bit1 = auto_select0
	auto_bit2 = auto_select1
	auto_bit3 = auto_select2
endif		

if auto_button = 1 OR auton_mode = 1 then 
	
	select (auto_select)
		case 0		'joy 1
			run 2
		case 1		'joy 2
			run 3
		case 2		'joy 3
			run 4
		case 3 		'joy 4
			run 5
		case 4 		'joy 5
			run 2
		case 5		'joy 6
			run 3
		case 6                     
		                run 4
		case 7
			'do nothing... just in case :-)
	endselect	

else
	gosub operator_control
endif
And really, it works quite efficently
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net