is it best to put the autonomous code in a SUB? or have it in the main loop? if it is in the main loop, how do you stop it from running if you aren’t in autonomous mode? I read the article here:
and I’d like to do my autonomous that way, but I just need to know where to put it.
We did it in a subroutine. That way, all we had to do was return at the end and thus we made sure we didn’t accidently have it do autonomous when we were supposed to drive.
I put ours in a sub and every function on our robot was in a sub and I always call all the subs, but at the top of the autonomous I put an if statement like this. if auton_mode = 0 then Return . This canceled the sub if we where not in autonomous mode.
Instead of using subs … why don’t you get the new version of P-basic and use multiple banks to switch between softwares.
It keeps it organized and its easy to use
i.e. If auton_mode = 1 THEN
… thats all it takes to switch between softwares … if you have anymore questions about how to use it … just e-mail me at
Multiple programs are nice but a program can be organized with subs. Multiple also works in the old version.