loops inside of subs???
hi, i have written a little code that will fire our pistons for approx. 3 seconds when one of the joystick buttons is pushed, so I wrote an if statement after the SERIN that
"if p2_sw_trig = 1 then GOSUB FIRE3"
that works and sends it to my sub code which looks like this:
FIRE3:
relay1_fwd = 1
MyCounter VAR byte
StepSize VAR byte
MyCounter = 1
FOR MyCounter = 1 TO 3001 STEP StepSize
StepSize = delta_t * 25
NEXT
relay1_fwd = 0
RETURN
but once i push the trigger, i get a basic run error, but, when i take away the FOR...NEXT statements, everything works, what's up with this? can i not do loops inside of subs? thanks a lot
Stephen
|