November 23, 2024, 03:09:25 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Need to modify coffin jumper

Started by geezer, May 27, 2010, 12:13:28 PM

Previous topic - Next topic

geezer

For the past couple of years I have had a prop I call a coffin jumper.  It is a coffin that is upright, leaning against a wall.  A PIR initiates the prop-1, which first opens the coffin door, pauses, then sends the corpse out on a scissor arm.  Three seconds later the scissor arm retracts, then the coffin door closes and the whole thing resets.  I had a friend do the programming, which has run perfectly for two years.
This year I want to change things up a bit.  I want the corpse to remain extended until a second trigger input is received.  The second input should retract the corpse, close the door, and pause a five seconds before it resets.  More importantly, if the second trigger input is not received within ~8 seconds, I need the whole thing to return and reset without the second input.
This will be for a small maze that requires people to select a certain item by solving a riddle.  Selecting the correct item will activate the second trigger input, selecting the wrong item will cause a buzzer to sound.  I will have at least three "riddle stations" with similar props that could use the same program (I have three Prop-1 controllers right now, may buy more).  Is there a way to tie these controllers together in order to count the number of correct responses per team?
Rick

JonnyMac

Here's a program to get you going -- sans "networking" (which is not easy or practical with the Prop-1).

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Trigger2        = PIN7                  ' SETUP = DN (Retract)
SYMBOL  Trigger1        = PIN6                  ' SETUP = DN (Jump)

SYMBOL  Corpse          = PIN1
SYMBOL  Door            = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  IsOpen          = 1
SYMBOL  IsClosed        = 0

SYMBOL  IsOut           = 1
SYMBOL  IsHiding        = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  triggers        = B0
SYMBOL   trRetract      =  BIT7
SYMBOL   trJump         =  BIT6

SYMBOL  timer           = B2
SYMBOL  delay           = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs

  PAUSE 20000                                   ' warm-up/retrigger delay

' -----[ Program Code ]----------------------------------------------------

Main:
  GOSUB Scan_Triggers
  IF trJump = IsOff THEN Main                   ' wait for Jump input

  Door = IsOpen
  PAUSE 1000                                    ' give door some time
  Corpse = IsOut                                ' jump

  delay = 8000                                  ' max time is 8s

Skele_Hold:
  IF delay < 100 THEN Retract                   ' delay done?
    delay = delay - 100                         ' no update
    GOSUB Scan_Triggers                         ' and scan triggers

  IF trRetract = IsOff THEN Skele_Hold          ' check retract input

Retract:
  Corpse = IsHiding
  PAUSE 1500                                    ' let it retract
  Door = IsClosed

  GOTO Reset


' -----[ Subroutines ]-----------------------------------------------------

' Scans trigger inputs (P7 & P6) and creates 100ms delay

Scan_Triggers:
  triggers = %11000000                          ' assume active
  FOR timer = 1 TO 20
    PAUSE 5                                     ' debounce delay
    triggers = triggers & PINS                  ' scan inputs
  NEXT
  RETURN

' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office