November 23, 2024, 12:19:25 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Zombie thrasher

Started by Deathstalker, October 15, 2009, 08:59:15 PM

Previous topic - Next topic

Deathstalker

Sorry about that first post, I think that this maybe the place to start. I'm trying to use the casa de fear zombie program for my zombie thrasher also. I'm using a VM2 module with three sound tracks named, breathing, brains, and growling (all mp3). My question is, will this program start, run and stop the length of the sound track or do I need to insert the amount of run time to correspond with the sound tracks. This is a very complicated program for me to understand but I'm working on it and I think that I'm asking the right questions. Thanks for your help.
This is the program I'm tying to use.   

{$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P5.W and P5.R
'
'
' After downloading this program you should cycle power on the Prop-1 to
' allow synchronization with the VMUSIC player.


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


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

SYMBOL  RX              = 7                     ' SETUP = UP; no ULN pin
SYMBOL  TX              = 6                     ' SETUP = UP; no ULN pin
SYMBOL  Trigger         = PIN5                  ' ULN is pull-down
SYMBOL  Shoulder2       = PIN1                  ' use V+/OUT1 terminals
SYMBOL  Shoulder1       = PIN0                  ' use V+/OUT0 terminals


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0                     ' put back to low/off

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' baud for VMusic


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

SYMBOL  idx             = B2
SYMBOL  valves          = B3
SYMBOL  last            = B4

SYMBOL  delay           = W3
SYMBOL  timer           = W4
SYMBOL  lottery         = W5


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

Power_Up:
  PAUSE 2250                                    ' let VMUSIC power up

Reset:
  PINS = %00000000                              ' preset IO pins
  DIRS = %00000011                              ' define IO pins

  GOSUB VM_Stop                                 ' stop if playing
  GOSUB VM_Wait_Prompt

  PAUSE 10000                                   ' 10s inter-show delay


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery                                ' randomize lottery value
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' inc or clear timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

Jump:
  PINS = %00000011                              ' both shoulders on
  PAUSE 1000                                    ' adjust for audio

Audio_Activate:
  SEROUT TX, Baud, ("VPF zombie.mp3", 13)
  GOSUB VM_Wait_Start
  PAUSE 100                                     ' adjust for audio

  timer = 0                                     ' reset timer

Thrasher:
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT
  valves = lottery & %00000011

  IF valves = last THEN Thrasher                ' no repeats
    last = valves                               ' save for next cycle

  PINS = valves                                 ' update should outputs
  RANDOM lottery                                ' restir
  delay = lottery // 251 + 100                  ' delay 100 to 350 ms
  PAUSE delay
  timer = timer + delay                         ' update timer
  IF timer < 10000 THEN Thrasher                ' thrash for 10 seconds
    GOTO Reset


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

VM_Stop:
  SEROUT TX, Baud, ("VST", 13)
  RETURN

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

VM_Wait_Prompt:
  SERIN RX, Baud, (">")
  RETURN

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

VM_Wait_Start :
  SERIN RX, Baud, ("T $")
  RETURN


JonnyMac

If you go back to the original thread you'll see a program I wrote this morning that you can start with -- the original poster, it seems, also decided to go with multiple audio tracks.  There is a LOOKUP line that needs adjusting for the duration of each audio, and the files must be named zombie1.mp3, zompie2.mp3, etc.
Jon McPhalen
EFX-TEK Hollywood Office