Shop OBEX P1 Docs P2 Docs Learn Events
Waiting for inputs — Parallax Forums

Waiting for inputs

Blackbird455Blackbird455 Posts: 124
edited 2007-10-19 19:06 in BASIC Stamp
I know I haven't stirred up anything in a while..............been real busy.........

· I want a BS1 to take inputs and respond like this:
(not using proper syntax for a stamp I know........been up for over 24 hours)
if
pin1=1
pin2=1
pin1=1
pin2=1
then start 'within a scope of lets say 5 seconds, and after it takes· this in, I will follow it woth an output.
start
....
....
....
if
pin2=1
pin1=1
pin2=1
pin1=1
then stop
stop
....
....
....
if this isnt enough info to "get my drift" then I will be back on around 1800 cst tonight.

If you have a code example, that would be very helpful.

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Noli nothis permittere te terere

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-19 19:06
    What do you want to do about waiting for the pin(s) to go back to zero?

    In other words, you say you want to test for pin1=1.
    Do you want to wait for it to go back to zero before you test for pin2=1?

    Would something like this do?
    state0:
      if pin1=0 then state0 ' wait for pin1=1
    state1:
      if pin1=1 then state1 ' wait for pin1=0
    state2:
      if pin2=0 then state2 ' wait for pin2=1
    state3:
      if pin2=1 then state3 ' wait for pin2=0
    


    You'd repeat this again for states 4-7 and then do your start thing.
    You could then repeat the same idea with pin1 and pin2 swapped
    for the stop control sequence. None of this addresses what you
    want to do if you get part way through the state sequence and
    make a mistake. In other words, there's no provision for a reset.
    You'll have to decide how you want to do that (in terms of what
    the user does).
Sign In or Register to comment.