View Single Post
  #8   Spotlight this post!  
Unread 03-02-2003, 23:52
wwrye wwrye is offline
Registered User
#0057 (Leopards)
 
Join Date: Jan 2003
Location: Houston
Posts: 18
wwrye is an unknown quantity at this point
Angry redundance

Mike, what is up with all the identical code, don't you think you could go with the flow of the main loop and just do something like this:
Code:
':::Timer variables
cntr_cycles 	VAR byte
seconds		VAR nib '15 sec timer,make byte for more time

seconds = 0           'same as your realtime variable
cntr_cycles = 0       'same as your time variable

...

if auton_mode = 1 then do_auton

	'non autonomous code	

	
goto skip_auton
do_auton:

':::15 second TIMER::
	if cntr_cycles >= 38 then update_timer

	goto skip_update_timer
	update_timer:
		seconds = seconds + 1
		cntr_cycles = 0
	
	skip_update_timer:

		select seconds
			case <6  'until seconds = 5
				drive_R = 180	'put drive commands accordingly
				drive_L = 180
			case <11 
				drive_R = 127
				drive_L = 127
			case <16
				drive_R = 64
				drive_L = 190	
		endselect

	cntr_cycles = cntr_cycles + 1 + delta_t
	'debug ?cntr_cycles, tab, ?delta_t, tab, ?cntr_cycles, cr
':::15 second TIMER::
Questions/comments, pm me