November 21, 2024, 11:27:32 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Prop-1 program help

Started by Marcharius, October 22, 2010, 11:33:50 PM

Previous topic - Next topic

JonnyMac

You could add another step to the table, with a zero time value:

  EEPROM (%0000,  0)

Put this at the end and change the FOR-NEXT range of idx to 1 to 6.   
Jon McPhalen
EFX-TEK Hollywood Office

Marcharius

Thanks again for all of the help guys and Ill let you know how it works as soon as I get it tested.

Marcharius

October 26, 2010, 01:21:00 PM #17 Last Edit: October 26, 2010, 01:22:36 PM by Marcharius
This is my current revision of the program, I have highlighted the additions. This is pre-test, which I will get around to tonight or tomorrow, but I think there is a good chance this will be the final revision.....hopefully  :P

' =========================================================================
'
'   File......   Vampire Hunter
'   Purpose...   Runs audio, lights, and sound for vampire coffin scene
'   Author....   JohnnyMac & Abe Craig
'   E-mail....   N/A
'   Started...   Halloween 2010
'   Updated...   many times ;)
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'The RC-4 is connected to 3 lights, one for each person in the scene and
'they are turned on depending on who is speaking at the time. The last RC-4
'connection controls the pneumatic on the Vampire Coffin Jumper. The
'program will cycle through each scene continually.

' -----[ Revision History ]------------------------------------------------
'Revisions are simple and deal with timing issues and small bug that left vampire
'light and prop on after dialog scene.

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

SYMBOL  TX              = 7                     ' SETUP = UP; no ULN
SYMBOL  Sio             = 6                     ' SETUP = UP; no ULN

SYMBOL  ManBtn          =  PIN2
SYMBOL  AutoTog         =  PIN1
SYMBOL  AutoBtn         =  PIN0                 ' active-high on P0

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

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

SYMBOL  Baud            = OT2400


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

SYMBOL  relays          = B0

SYMBOL  triggers        = B2
SYMBOL  audio           = B3
SYMBOL  theMP3          = B4
SYMBOL  idx             = B5
SYMBOL  eePntr          = B6

SYMBOL  timer           = W5


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

Reset:
 PAUSE 2250                                    ' let VMUSIC power up
 relays = IsOff
 GOSUB Set_RC4
 GOTO Pgm_Delay


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

Main:
 triggers = PINS & %111                        ' mask inputs
 IF triggers = %011 THEN Fire                  ' AutoBtn + AutoTog
 IF triggers = %100 THEN Fire                  ' ManBtn
 GOTO Main

Fire:
 audio = audio + 1
  IF audio = 1 THEN Dialog   REMOVED
 IF audio = 2 THEN Scream

Dialog2:
 theMP3 = 1
 GOSUB Play_MP3

removed uneeded 2 second delay


 eePntr = 0                                    ' top of show
 FOR idx = 1 TO 5                              ' steps in show
   READ eePntr, relays                         ' get RC-4 bits
   eePntr = eePntr + 1
   READ eePntr, timer                          ' get timing
   eePntr = eePntr + 1
   GOSUB Set_RC4                               ' update RC-4
   timer = timer * 100                         ' convert to ms
   PAUSE timer                                 ' hold
 NEXT

 GOTO Reset


Scream:
 theMP3 = 2
 GOSUB Play_MP3

removed uneeded 2 second delay

 relays = %1100
 GOSUB Set_RC4
 PAUSE 5000
                                   ' adjust for scream
 audio = 0

 GOTO Reset


Pgm_Delay:
 theMP3 = 0
 GOSUB Play_MP3
 PAUSE 27750        adjusted time to equal 30 sec with reset delay
 GOTO Main


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

' Sets RC-4 outputs to bits in 'relays'

Set_RC4:
 SEROUT Sio, Baud, ("!RC4", %11, "S", relays)
 RETURN

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

' Stops player and starts new audio (if 'theMP3' is valid)

Play_MP3:
 SEROUT TX, Baud, ("VST", 13)                  ' stop player
 PAUSE 2000
 BRANCH theMP3, (Play_0, Play_1, Play_2)
 RETURN                                        ' bad file #

Play_0:
 SEROUT TX, Baud,("VPF bckgrnd.mp3", 13)
 RETURN

Play_1:
 SEROUT TX, Baud,("VPF dialog2.mp3", 13)
 RETURN

Play_2:
 SEROUT TX, Baud,("VPF scream.mp3", 13)
 RETURN

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

Dialog_Show:
 EEPROM (%0001,  75)                           ' grave digger
 EEPROM (%0010,  55)                           ' Van Helsing
 EEPROM (%0001,  85)                           ' grave digger
 EEPROM (%0000,  55)                           ' all off
 EEPROM (%1100, 100)                           ' vampire (pop + light