November 21, 2024, 10:01:36 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.


Screaming skull table

Started by lottafun4u, September 12, 2007, 10:12:51 PM

Previous topic - Next topic

lottafun4u

Hello Jon,
 
  I have been working on a more complex prop that has several movements and now I would like to make the whole program run three times before it shuts down for the next guests. I will attach what I have so you can take a look. Hope you don't laugh too much at this, I'm still very new to all this, but i'm having a blast !!
Also, can the AP-8 run in a loop as a stand alone sound board without a prop-1 or a trigger ?

Thank you very much for all of your help. Hope to see you at Hauntcon in April.

JonnyMac

September 13, 2007, 10:21:55 AM #1 Last Edit: September 13, 2007, 10:23:28 AM by JonnyMac
The program looks fine.  Allow me two suggestions:
1) Use white space -- blank lines.  This will make your program easier to read, especially when you're tired.
    -- I usually put blank lines after PAUSE as this helps show the flow of the program
2) You can use GOTO Reset at the end so the warm-up delay is used as the retrigger delay; this clears the outputs too.

Like this:

' =========================================================================
'
'   File...... Screaming Skull Table
'   Purpose...
'   Author.... Carl Schober
'   E-mail....
'   Started... 09/11/07
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  Chest           = PIN4
SYMBOL  Arms            = PIN3
SYMBOL  Mouth           = PIN2
SYMBOL  skull           = PIN1
SYMBOL  Light           = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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

SYMBOL  pirTimer        = B2                    ' for debouncing PIR


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

Reset:
  PINS = %00000000
  DIRS = %00011111                              ' set outputs

  PAUSE 20000                                   ' warm-up / retrigger delay


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

Main:
  pirTimer = 0

PIR_Wait:
  PAUSE 10
  pirTimer = pirTimer + 10 * PIR                ' update timer
  IF pirTimer < 250 THEN PIR_Wait

  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)     ' start audio

  Light = IsOn                                  ' turn on led
  PAUSE 250

  Skull = IsOn                                  ' skull turns to guest
  Arms = IsOn                                   ' arms come out
  Mouth = IsOn                                  ' mouth opens
  PAUSE 2000                                    ' wait 2 seconds

  Arms = IsOff                                  ' arms go back
  Chest = IsOn                                  ' ribs move up
  PAUSE 2000                                    ' wait 2 seconds

  Mouth = IsOff                                 ' mouth shuts
  chest = IsOff                                 ' ribs go down
  Skull = IsOff                                 ' Skull turns away
  PAUSE 1000                                    ' wait 1 second

  Skull = IsOn                                  ' twitch
  Mouth = IsOn                                  ' twitch
  Arms = IsOn                                   ' twitch
  Chest = IsOn                                  ' twitch
  PAUSE 500                                     ' slight delay

  Skull = IsOff                                 ' settle down
  Mouth = IsOff                                 ' settle down
  Arms = IsOff                                  ' settle down
  Chest = IsOff                                 ' settle down
  PAUSE 350                                     ' wait 1/3 second

  Light = IsOff                                 ' led turns off

  GOTO Reset


Yes, the AP-8 can run stand-alone.  If you close the L (loop) switch it will play the selected segment (switches 0,1,2) until it is powered down.  To start it, press the play button.
Jon McPhalen
EFX-TEK Hollywood Office