Shop OBEX P1 Docs P2 Docs Learn Events
Is what I want to do posible — Parallax Forums

Is what I want to do posible

StampStumpedStampStumped Posts: 7
edited 2005-10-28 05:01 in BASIC Stamp
I am I nubie, I have a basic stamp 2 and I want know if I will run into trouble with it if I try and to the following:
·
Start button pushed.
·
Beginning.
Look up next number on table, or generate a random number between 1 and 9
·
Each number will correspond to a Subroutine
·
Subroutines one 1 though 6 will all be the same. Each will ·turn on a light and drive one leg of an AND gate time and start a timer.· If a button is ·pushed before the timer goes to Zero then 1 is added to counter A. Program loops to the beginning
·
·Subroutines one 7 though 9 will all be the same. Each will ·turn on a light and drive one leg of an AND gate time and start a timer.· If a button is NOT pushed before the timer goes to Zero then 1 is added to counter B.· The program then loops back to the beginning.·
·
Does this look like something a stamp 2 will be able to do?· Would be easier if a got a different kind of stamp? ·Any direction would be helpful.· It seems like adding some kind of external timing circuit might make things easier, what do you all think.·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-28 00:12
    A more informative subject line might generate more responses.· I'm sure the Stamp can do what you're looking to do, but my question would be, why would you want multiple identical subroutines?· Why not just call the same one as needed?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • metron9metron9 Posts: 1,100
    edited 2005-10-28 05:01
    Hmmm... Need input....

    How many lights Nine?
    How many AND gates, Nine?
    How Many Timers, Nine?
    How much time will be set on timers

    Think about doing psudo code to help design the logic

    For example

    MainLoop:
    Pick random Number X
    Set timer X
    Set pin X high to turn on one leg of and gate

    timerloop:

    countdown timer

    if timer X=0 then
    If X<7 then A=A+1
    if x>6 then B=B+1
    goto mainloop
    endif

    goto timerloop
Sign In or Register to comment.