May 20, 2024, 08:33:20 AM

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.


quick question, a little over my head..

Started by fearfair, September 18, 2011, 09:00:46 AM

Previous topic - Next topic

fearfair

This program checks for a button press, then:

1) turns power on to a media player that plays an intro video in our opening room (relay, powerswitchtail), then
2) sends a button press to a second media player in an asylum door style prop (soldier shooting at door), then
3) turns on a solenoid to extend cylinders simulating bullet hits on door, then
4) turns off that solenoid and turns on a second solenoid to slide the door open, then
5) turns on relays to power other prop 1's running electric firecrackers, and
6) triggers a boo box running a Scarefactory slayer..

What I want to do leave the media player in step 1 powered on while steps 2-6 execute.. it's written in a linear step through fashion presently... how would I change it to leave the media player in step one powered on for a set period of time, but go ahead and start the rest of the loop before that time is over?

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


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


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


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

SYMBOL  Start           = PIN7                  ' SETUP = out; no ULN
SYMBOL  Close           = PIN6                  ' SETUP = DN
SYMBOL  Intro           = PIN5
SYMBOL  Slayer          = PIN4
SYMBOL  Crackers        = PIN3
SYMBOL  Door            = PIN2
SYMBOL  Bullet          = PIN1
SYMBOL  Video           = PIN0


' -----[ Constants ]-------------------------------------------------------
SYMBOL  NotPressed      = 1                     ' for active-low
SYMBOL  Pressed         = 0

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = W0


SYMBOL  tix             = W1


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00111111                              ' set outputs


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:                                  ' debounce input
  PAUSE 5                                       ' loop pad
timer = timer + 5
IF Start = NotPressed THEN Main
IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input


lets_go:
  Intro = IsOn
  PAUSE 150000
  Intro = IsOff

  Video = IsOn
  PAUSE 5000
  Video = IsOff
  PAUSE 1000

  Bullet = IsOn
  PAUSE 5000
  Bullet = IsOff

  Door = IsOn
  PAUSE 5000

  Slayer = IsOn
  PAUSE 1000
  Slayer = IsOff

  Crackers = IsOn
  PAUSE 1000
  Crackers = IsOff

Check_Close_Reset:
  timer = 0

Check_Close:                                  ' debounce input
  PAUSE 5                                       ' loop pad
timer = timer + 5
IF Close = NotPressed THEN Check_Close_Reset
IF timer < 100 THEN Check_Close             ' wait for 0.1 sec input


  Door = IsOff

GOTO Reset


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



' -----[ User Data ]-------------------------------------------------------

JonnyMac

In the beginning you have:

Lets_Go:
  Intro = IsOn
  PAUSE 150000
  Intro = IsOff


I'm assuming this starts the intro video.  The start is no problem, the delay is.  You cannot use a value greater than 65535 in a PAUSE command.  So, if you want a 2.5 minute delay, do this

Lets_Go:
  Intro = IsOn
  PAUSE 60000
  PAUSE 60000
  PAUSE 30000


And by removing the Intro = IsOff line the media player stays powered.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

fearfair,
      Not exactly sure of your timing but if you want the rest of the program to run while your intro video is playing, in addition to removing Intro = IsOff  you would delete the PAUSE after Intro = IsOn . You would have to go further down the program to the point where you want the media player to power down and insert  Intro = IsOff .