Coin Operated Controller
Archiver
Posts: 46,084
Hello-
I'm new to the world of basic stamps, and I was wondering if someone
could give me a little bit of assistance setting up a new program.
I'm attempting to build a prototype arcade game which loops a track
on a DVD player, waiting for a coin input. When the input is recieved
it switches over to another track on the DVD.
So far I've got:
Loop:
LOW 10 'turn on dvd attract track
PAUSE 1000 'pause for 1 second, 1000 milliseconds
HIGH 10 'release button
PAUSE 20000 'wait for 20 seconds, then repeat
GOTO Loop:
How do I interrupt this cycle if when another input is sensed?
-Lou
I'm new to the world of basic stamps, and I was wondering if someone
could give me a little bit of assistance setting up a new program.
I'm attempting to build a prototype arcade game which loops a track
on a DVD player, waiting for a coin input. When the input is recieved
it switches over to another track on the DVD.
So far I've got:
Loop:
LOW 10 'turn on dvd attract track
PAUSE 1000 'pause for 1 second, 1000 milliseconds
HIGH 10 'release button
PAUSE 20000 'wait for 20 seconds, then repeat
GOTO Loop:
How do I interrupt this cycle if when another input is sensed?
-Lou
Comments
one went through- well, my second post was more in depth, so maybe it
was for the best...
-Lou
--- In basicstamps@y..., "Louis Klepner" <varuna123@y...> wrote:
> Hello-
>
> I'm new to the world of basic stamps, and I was wondering if
someone
> could give me a little bit of assistance setting up a new program.
>
> I'm attempting to build a prototype arcade game which loops a track
> on a DVD player, waiting for a coin input. When the input is
recieved
> it switches over to another track on the DVD.
>
> So far I've got:
>
> Loop:
> LOW 10 'turn on dvd attract track
> PAUSE 1000 'pause for 1 second, 1000 milliseconds
> HIGH 10 'release button
> PAUSE 20000 'wait for 20 seconds, then repeat
> GOTO Loop:
>
> How do I interrupt this cycle if when another input is sensed?
>
> -Lou
> >
> > Loop:
> > LOW 10 'turn on dvd attract track
> > PAUSE 1000 'pause for 1 second, 1000 milliseconds
> > HIGH 10 'release button
> > PAUSE 20000 'wait for 20 seconds, then repeat
> > GOTO Loop:
> >
> > How do I interrupt this cycle if when another input is sensed?
> >
> > -Lou
Well first, you need some instruction in the loop that reads an input
from the coin sensor and branches to another part of the program when
it's found.
Second, don't pause for 20000 ms - it's way to long because, as
written, you'll take that 20 second pause no matter what happens.
Instead, pause for 10 ms but repeat it 2000 times, while checking
your input condition:
Pseudo code:
loop:
for I = 1 to 2000
if coin input on then goto x
pause 10
next
do whatever you do when the 20 seconds are up
goto loop
x: do whatever you do when the coin input comes on
goto loop
This is oversimplified, but you get the idea.
Chuck
This gets tricky when you want to do multiple things at once and/or
try to time multiple events at the same time, but it can be done.
Okay, that makes sense. Thanks for the help. If I had
gone into a pause mode, I would be stuck for however
long the pause was- Instead I should have a shorter
loop occur more frequently.
I'm going to get back to coding... Thanks for the
pointer!
-Lou
--- Chuck Davis <cdavis@o...> wrote:
> > > So far I've got:
> > >
> > > Loop:
> > > LOW 10 'turn on dvd attract track
> > > PAUSE 1000 'pause for 1 second, 1000
> milliseconds
> > > HIGH 10 'release button
> > > PAUSE 20000 'wait for 20 seconds, then repeat
> > > GOTO Loop:
> > >
> > > How do I interrupt this cycle if when another
> input is sensed?
> > >
> > > -Lou
>
> Well first, you need some instruction in the loop
> that reads an input
> from the coin sensor and branches to another part of
> the program when
> it's found.
>
> Second, don't pause for 20000 ms - it's way to long
> because, as
> written, you'll take that 20 second pause no matter
> what happens.
> Instead, pause for 10 ms but repeat it 2000 times,
> while checking
> your input condition:
>
> Pseudo code:
>
> loop:
> for I = 1 to 2000
> if coin input on then goto x
> pause 10
> next
> do whatever you do when the 20 seconds are up
> goto loop
> x: do whatever you do when the coin input comes
> on
> goto loop
>
> This is oversimplified, but you get the idea.
>
> Chuck
> This gets tricky when you want to do multiple things
> at once and/or
> try to time multiple events at the same time, but it
> can be done.
>
>
>
> 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/
>
>
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com