Multiple code problems
Archiver
Posts: 46,084
I'm working on a bot that detects and then avoids obsticles. I wrote
the code and everything works fine, but I have three sets of commands
that need to be repeated about 15 times each for my bot to move. I'm
using a Bs2 and some servo motors. I want to know if there is a
command that will execute a set of commands a certain number of
times, kinda like a semi loop I guess.
Thanx for your help,
-Mike
the code and everything works fine, but I have three sets of commands
that need to be repeated about 15 times each for my bot to move. I'm
using a Bs2 and some servo motors. I want to know if there is a
command that will execute a set of commands a certain number of
times, kinda like a semi loop I guess.
Thanx for your help,
-Mike
Comments
i think i understand what you're think of. i am getting just started
with a bot and a stamp and here is what i do. basically i call a
subroutine that calls another subroutine using the gosub. is this the
type of thing you want to do?
hope this helps,
-pete
iloop var byte
time var byte
time = 100
main:
gosub turnright
gosub circleleft
gosub turnright
goto main
turnright:
for iloop = 1 to time
gosub doright
next
return
circleleft:
for iloop = 1 to time
gosub softleft
next
return
doright:
pulsout 7, 2415
pulsout 8, 2436
pause 10
return
softleft:
pulsout 7, 1940
pulsout 8, 1186
pause 10
return
' 1790 is zero for left servo 7
' 1811 is zero for right servo 8
--- In basicstamps@yahoogroups.com, "laxboy687 <laxboy687@e...>"
<laxboy687@e...> wrote:
> I'm working on a bot that detects and then avoids obsticles. I wrote
> the code and everything works fine, but I have three sets of commands
> that need to be repeated about 15 times each for my bot to move. I'm
> using a Bs2 and some servo motors. I want to know if there is a
> command that will execute a set of commands a certain number of
> times, kinda like a semi loop I guess.
>
> Thanx for your help,
>
> -Mike
for i = 0 to 14
your code here
next i
this will loop 15 times and then move on
Larry Gaminde
Original Message
From: <laxboy687@e...>
To: <basicstamps@yahoogroups.com>
Sent: March 02, 2003 4:59 PM
Subject: [noparse][[/noparse]basicstamps] Multiple code problems
: I'm working on a bot that detects and then avoids obsticles. I wrote
: the code and everything works fine, but I have three sets of
commands
: that need to be repeated about 15 times each for my bot to move. I'm
: using a Bs2 and some servo motors. I want to know if there is a
: command that will execute a set of commands a certain number of
: times, kinda like a semi loop I guess.
:
: Thanx for your help,
:
: -Mike
:
:
: To UNSUBSCRIBE, just send mail to:
: basicstamps-unsubscribe@yahoogroups.com
: from the same email address that you subscribed. Text in the
Subject and Body of the message will be ignored.
:
:
: Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
:
: