November 22, 2024, 01:42:19 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.


Program for exorcist room show

Started by MassageMstr1, August 30, 2007, 04:04:09 PM

Previous topic - Next topic

MassageMstr1

I bought two Prop2s at HauntX this year and I remember you said that the programming is a little different.  I will be using one of them for my Exorcist room and I am chaging quite a few things in that room this year. 

This is what I have to use:

Prop2

24VDC power supply

RC-4

AP-8  (two if needed)

Relays (can be controlled by Pins or Outs)

izombie lightning machine (to make lights dim off and on and make a changing portrait change)  The CD and lightning machine will be on continuous and I will use a relay to open and close the circuit from the CD player to the izombie.

Manual trigger (will trigger a relay to complete the circuit on which ever port you choose for the trigger)

Here is the time line for events and what I'll be using.

Lights normal on

When triggered

1. Baby craddle will rock  (12VDC motor using a relay and it's own power supply because it draws too many amps to run though the prop2)

( 5 seconds inbetween)

2. Baby talks (AP-8) 1 track

( 8 seconds )

3. trigger izombie

4. Dresser Draws slam  (12VDC wipper motor, using a relay and own power supply) 

( 7 seconds  )

5. Baby spits  3 seconds ( 110VAC water pump, relay and own poewr supply or DC-4 )

6.  Everything stops and izombie is off.    (Timeline up to #6 is 23 seconds total)

( 5 seconds )

7. Trigger izombie

8. Bed bounces ( 110VAC solenoid controling 4 cyclinders, DC-4)  Random the on off cycle between .5 and 3 seconds)  I may need to play with those times once I see how well works or not.

( 10 secconds )

9. Bed levitates ( solenoid stays on )

( 3 seconds )

10. Reagan sits up ( 24VDC 3 watt solenoid )

( 4 seconds )

11.  Reagan Talks  ( AP-8 one track for 30 seconds )

( 12 seconds )  ( 12 seconds into Reagan talking not at the end )

12.  Head spins ( 110VAC motor - DC-4)

( 10 seconds )

13. Head stops spinning ( turn motor off )

( 9 seconds )

14. Reagan lays down ( 24VDC solenoid off)

( 3 seconds )

15.  Bed drops ( 110VAC solenoid off )

16. izombie off

17.  Goto Main  ( total time from #6 - #17 is 56 seconds.  Entire show is 79  seconds)


Thank you

Daniel

JonnyMac

Here you go, Daniel.  This version seems to be missing the random lamp control that you had last year -- did you leave that out or just decide you don't need it.  It would easy to add to the jumping bed loop using a separate RC-4.

' =========================================================================
'
'   File...... Exorcist2.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Sio             PIN     15                      ' for AP-8, no ULN or SETUP
Trigger         PIN     14                      ' SETUP = DN


Reagan          PIN     3
Dresser         PIN     2
IZombie         PIN     1
Cradle          PIN     0


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

IsOn            CON     1
IsOff           CON     0

IsUp            CON     1
IsDown          CON     0

Spinning        CON     1
Stopped         CON     0


T2400           CON     396
T38K4           CON     6
Open            CON     $8000

Baud            CON     Open | T38K4


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

lottery         VAR     Word
timer           VAR     Word
delay           VAR     Word

sfx             VAR     Nib

relays          VAR     Nib
Spitter        VAR     relays.BIT0             ' RC-4.K0
Bed            VAR     relays.BIT1             ' RC-4.K1
Head           VAR     relays.BIT2             ' RC-4.K2


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

Reset:
  SEROUT Sio, Baud, ["!!!!!!!!AP8", %00, "X", "!RC4", %00, "X"]

  DIRL = %00000111
  GOSUB All_Off


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

Main:
  RANDOM lottery                                ' stir random value
  IF (Trigger = IsOff) THEN Main                ' while waiting for trigger

  Cradle = IsOn                                 ' #1
  PAUSE 5000

  sfx = 7
  GOSUB Play_AP8                                ' #2
  PAUSE 8000

  IZombie = IsOn                                ' #3
  Dresser = IsOn                                ' #4
  PAUSE 7000

  Spitter = IsOn                                ' #5
  GOSUB Update_RC4
  PAUSE 3000

  GOSUB All_Off                                 ' #6
  PAUSE 5000

  IZombie = IsOn                                ' #7

Bounce_Bed:                                     ' #8
  timer = 0
  DO
    RANDOM lottery
    delay = lottery // 151 + 50                 ' random jump timing
    Bed = IsOn
    GOSUB Update_RC4
    PAUSE delay
    timer = timer + delay                       ' account for jump
    Bed = IsOff
    GOSUB Update_RC4
    RANDOM lottery
    delay = lottery // 2501 + 500               ' delay between jumps
    PAUSE delay
    timer = timer + delay                       ' update timer
  LOOP UNTIL timer >= 10000

  Bed = IsOn                                    ' #9
  GOSUB Update_RC4
  PAUSE 3000

  Reagan = IsUp                                 ' #10
  PAUSE 4000

  sfx = 0
  GOSUB Play_AP8                                ' #11
  PAUSE 12000

  Head = Spinning                               ' #12
  GOSUB Update_RC4
  PAUSE 10000

  Head = Stopped                                ' #13
  GOSUB Update_RC4
  PAUSE 9000

  Reagan = IsDown                               ' #14
  PAUSE 3000

  Bed = IsDown                                  ' #15
  GOSUB Update_RC4
  IZombie = IsOff                               ' #15

  GOTO Main


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

Play_AP8:
  SEROUT Sio, Baud, ["!AP8", %00, "P", sfx]
  RETURN

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

Update_RC4:
  SEROUT Sio, Baud, ["!RC4", %00, "S", relays]
  RETURN

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

All_Off:
  OUTS = $0000
  relays = %0000
  GOSUB Update_RC4
  RETURN


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

JonnyMac

August 31, 2007, 10:15:15 AM #2 Last Edit: August 31, 2007, 10:20:31 AM by JonnyMac
And for those wondering if I could have squeezed that program into a Prop-1... yes, but just barely.

' =========================================================================
'
'   File...... Exorcist2.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' for AP-8, no ULN or SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Reagan          = PIN3
SYMBOL  Dresser         = PIN2
SYMBOL  IZombie         = PIN1
SYMBOL  Cradle          = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0

SYMBOL  Spinning        = 1
SYMBOL  Stopped         = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  relays          = B0
SYMBOL   Spitter        = BIT0                  ' RC-4.K0
SYMBOL   Bed            = BIT1                  ' RC-4.K1
SYMBOL   Head           = BIT2                  ' RC-4.K2

SYMBOL  sfx             = B1

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


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

Reset:
  SEROUT Sio, Baud, ("!!!!!!!!AP8", %00, "X", "!RC4", %00, "X")

  DIRS = %00000111
  GOSUB All_Off


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

Main:
  RANDOM lottery                                ' stir random value
  IF Trigger = IsOff THEN Main                  ' while waiting for trigger

  Cradle = IsOn                                 ' #1
  PAUSE 5000

  sfx = 7
  GOSUB Play_AP8                                ' #2
  PAUSE 8000

  IZombie = IsOn                                ' #3
  Dresser = IsOn                                ' #4
  PAUSE 7000

  Spitter = IsOn                                ' #5
  GOSUB Update_RC4
  PAUSE 3000

  GOSUB All_Off                                 ' #6
  PAUSE 5000

  IZombie = IsOn                                ' #7

Bounce_Bed:                                     ' #8
  timer = 0

Bounce_Again:
  RANDOM lottery
  delay = lottery // 151 + 50                   ' random jump timing
  Bed = IsOn
  GOSUB Update_RC4
  PAUSE delay
  timer = timer + delay                         ' account for jump
  Bed = IsOff
  GOSUB Update_RC4
  RANDOM lottery
  delay = lottery // 2501 + 500                 ' delay between jumps
  PAUSE delay
  timer = timer + delay                         ' update timer
  IF timer < 10000 THEN Bounce_Again

  Bed = IsOn                                    ' #9
  GOSUB Update_RC4
  PAUSE 3000

  Reagan = IsUp                                 ' #10
  PAUSE 4000

  sfx = 0
  GOSUB Play_AP8                                ' #11
  PAUSE 12000

  Head = Spinning                               ' #12
  GOSUB Update_RC4
  PAUSE 10000

  Head = Stopped                                ' #13
  GOSUB Update_RC4
  PAUSE 9000

  Reagan = IsDown                               ' #14
  PAUSE 3000

  Bed = IsDown                                  ' #15
  GOSUB Update_RC4
  IZombie = IsOff                               ' #15

  GOTO Main


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

Play_AP8:
  SEROUT Sio, Baud, ("!AP8", %00, "P", sfx)
  RETURN

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

Update_RC4:
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN

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

All_Off:
  PINS = %00000000
  relays = %0000
  GOSUB Update_RC4
  RETURN


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

MassageMstr1

Thanks Jon, you Rock!

Last year I had the RC-4 turn off the lights and turn on a strob light.  This year I thought it would be more realistic and spooky to just have the lights dim and flicker like something was disturbing the electricity, plus it works well with the changing protraits we made in March.  I am hoping to have this room completed this weekend and I'll let you know how it comes out.  Also I'm getting a new computer so I will be able to post video and you can see it working.

Thanks again!

Daniel

MassageMstr1

Hey Jon,

I am having a few problems.  The RC-4 is not working.  I have it hooked up to PIN15 and then the AP-8 hooked up to the RC-4.  I haven't finished recording the sounds for the AP-8 so I do not know if that is working or not.   I changed the ULN on the Prop2 and removed the jumper.  Is there anything I forgot?  I am having a few other problems, but i will double check all of my connections before bothering you with them.

Daniel

JonnyMac

Since you have the RC-4 first in the chain it is probably the baud rate jumper -- it needs to be out for the Prop-2 to use high-speed comms.
Jon McPhalen
EFX-TEK Hollywood Office

MassageMstr1

If you are talking about the two pin baud on the RC-4 just below the seral pins, the jumper is already off.  I thought the RC-4 had to go first because it gets it's power from the prop1 or prop2.

JonnyMac

What is the Rev code on your RC-4?  On boards that support full serial communications you should find two, 3-pin headers for the serial connection near the K1 terminal, then below that three, 2-pin headers; the 2-pin header closed to the serial headers is the baud selection, put a jumper on it for 38.4K comms.
Jon McPhalen
EFX-TEK Hollywood Office

MassageMstr1

Hey Jon,

I'm having problems getting the AP-8s to work.  I added a second AP-8 to the code below.  The doll is suppose to talk at #1 for 28 sec, and then at #3 for 8 sec.   Those of those sound tracks are on AP8 %00    Reagan talks at #12 for 12 sec.  She is on AP8_2 %01.  I have played the sounds fron both AP-8s and they work.  But neither one is working when hooked up to the Prop2. 

I have switched the ULN to ULN2003 (the shorter one).  I'm going from PIN 15 to the RC-4 serial (the RC4 works)  Then from the other serial on the RC-4 to the AP8 %00 serial.  Then from the other serial on AP8 %00 to AP8 %01. 

I have the jumper off B/R on both AP-8s.  I have Id1 and Id0 jumpers off AP-8 %00 and the Id1 jumper off AP-8 %01.  And I have the switches all turned on for 2, 1, 0  on both AP-8s

What did I miss or is the code incorrect?


       ' =========================================================================
'
'   File...... Exorcist2.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started... 8/31/07
'   Updated... Daniel 9/5/07
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Sio             PIN     15                      ' for AP-8, no ULN or SETUP
Trigger         PIN     14                      ' SETUP = DN


Reagan          PIN     3
Dresser         PIN     2
IZombie         PIN     1
Cradle          PIN     0


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

IsOn            CON     1
IsOff           CON     0

IsUp            CON     1
IsDown          CON     0

Spinning        CON     1
Stopped         CON     0


T2400           CON     396
T38K4           CON     6
Open            CON     $8000

Baud            CON     Open | T38K4


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

lottery         VAR     Word
timer           VAR     Word
delay           VAR     Word

sfx             VAR     Nib

relays          VAR     Nib
Spitter        VAR     relays.BIT0             ' RC-4.K0
Bed            VAR     relays.BIT1             ' RC-4.K1
Head           VAR     relays.BIT2             ' RC-4.K2


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

Reset:
  SEROUT Sio, Baud, ["!!!!!!!!AP8", %00, "X", "!RC4", %00, "X", "!AP8", %01, "X"]

  DIRL = %00000111
  GOSUB All_Off


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

Main:
  RANDOM lottery                                    ' stir random value
  IF (Trigger = IsOff) THEN Main                ' while waiting for trigger

  sfx = 0
  GOSUB Play_AP8                                ' #1  Dolls rhyme 28 sec. 
  PAUSE 28000

  Cradle = IsOn                                    ' #2  Cradle rocks
  PAUSE 5000

  sfx = 7
  GOSUB Play_AP8                                ' #3 Dolls gives warning 8 sec.
  PAUSE 8000

  IZombie = IsOn                                ' #4
  Dresser = IsOn                                 ' #5
  PAUSE 7000

  Spitter = IsOn                                 ' #6
  GOSUB Update_RC4
  PAUSE 3000

  GOSUB All_Off                                 ' #7
  PAUSE 5000

  IZombie = IsOn                                ' #8

Bounce_Bed:                                     ' #9
  timer = 0
  DO
    RANDOM lottery
    delay = lottery // 251 + 50                 ' random jump timing
    Bed = IsOn
    GOSUB Update_RC4
    PAUSE delay
    timer = timer + delay                       ' account for jump
    Bed = IsOff
    GOSUB Update_RC4
    RANDOM lottery
    delay = lottery // 1501 + 50               ' delay between jumps
    PAUSE delay
    timer = timer + delay                       ' update timer
  LOOP UNTIL timer >= 10000

  Bed = IsUp                                    ' #10
  GOSUB Update_RC4
  PAUSE 3000

  Reagan = IsUp                                 ' #11
  PAUSE 4000

  sfx = 0
  GOSUB Play_AP8_2                              ' #12
  PAUSE 12000

  Head = Spinning                               ' #13
  GOSUB Update_RC4
  PAUSE 7000

  Head = Stopped                                ' #14
  GOSUB Update_RC4
  PAUSE 9000

  Reagan = IsDown                               ' #15
  PAUSE 3000

  Bed = IsDown                                  ' #16
  GOSUB Update_RC4
  IZombie = IsOff                               ' #17

  PAUSE 30000

  GOTO Main


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

Play_AP8:
  SEROUT Sio, Baud, ["!AP8", %00, "P", sfx]
  RETURN

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

Play_AP8_2:
  SEROUT Sio, Baud, ["!AP8", %01, "P", sfx]
  RETURN

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

Update_RC4:
  SEROUT Sio, Baud, ["!RC4", %00, "S", relays]
  RETURN

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

All_Off:
  OUTS = $0000
  relays = %0000
  GOSUB Update_RC4
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

JonnyMac

When using the Prop-2 at 38.4K baud you need the B/R jumper on.
Jon McPhalen
EFX-TEK Hollywood Office

livinlowe

Jon-
Sorry, but doesn't the jumper on the RC4 have to be on to communicate with a prop2?

Shawn
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

When using ANY EFX-TEK accessory with the Prop-2 or Prop-SX at 38.4K baud, the B/R jumper needs to be installed.  Also, unless you have Rev. D AP-8 modules, the RC-4 must be connected to the Prop-2 first so that it gets power (the Rev. D AP-8s pass power through, earlier revisions don't).

The code looks fine; I made a couple very minor efficiency tweaks.

' =========================================================================
'
'   File...... Exorcist2.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started... 8/31/07
'   Updated... Daniel 9/5/07
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Connections:
'
'   Prop-2 --> RC-4.%00 --> AP-8.%00 --> AP-8.%01


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


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

Sio             PIN     15                      ' for AP-8, no ULN or SETUP
Trigger         PIN     14                      ' SETUP = DN

Reagan          PIN     3
Dresser         PIN     2
IZombie         PIN     1
Cradle          PIN     0


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

IsOn            CON     1
IsOff           CON     0

IsUp            CON     1
IsDown          CON     0

Spinning        CON     1
Stopped         CON     0


T2400           CON     396
T38K4           CON     6
Open            CON     $8000

Baud            CON     Open | T38K4


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

lottery         VAR     Word
timer           VAR     Word
delay           VAR     Word

sfx             VAR     Byte

relays          VAR     Byte
Spitter        VAR     relays.BIT0             ' RC-4.K0
Bed            VAR     relays.BIT1             ' RC-4.K1
Head           VAR     relays.BIT2             ' RC-4.K2


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

Reset:
  SEROUT Sio, Baud, ["!!!!!!!!AP8", 255, "X", "!RC4", %00, "X"]

  DIRL = %00000111
  GOSUB All_Off


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

Main:
  RANDOM lottery                                ' stir random value
  IF (Trigger = IsOff) THEN Main                ' while waiting for trigger

  sfx = 0
  GOSUB Play_AP8                                ' #1  Dolls rhyme 28 sec.
  PAUSE 28000

  Cradle = IsOn                                 ' #2  Cradle rocks
  PAUSE 5000

  sfx = 7
  GOSUB Play_AP8                                ' #3 Dolls gives warning 8 sec.
  PAUSE 8000

  IZombie = IsOn                                ' #4
  Dresser = IsOn                                ' #5
  PAUSE 7000

  Spitter = IsOn                                ' #6
  GOSUB Update_RC4
  PAUSE 3000

  GOSUB All_Off                                 ' #7
  PAUSE 5000

  IZombie = IsOn                                ' #8

Bounce_Bed:                                     ' #9
  timer = 0
  DO
    RANDOM lottery
    delay = lottery // 251 + 50                 ' random jump timing
    Bed = IsOn
    GOSUB Update_RC4
    PAUSE delay
    timer = timer + delay                       ' account for jump
    Bed = IsOff
    GOSUB Update_RC4
    RANDOM lottery
    delay = lottery // 1501 + 50               ' delay between jumps
    PAUSE delay
    timer = timer + delay                       ' update timer
  LOOP UNTIL timer >= 10000

  Bed = IsUp                                    ' #10
  GOSUB Update_RC4
  PAUSE 3000

  Reagan = IsUp                                 ' #11
  PAUSE 4000

  sfx = 0
  GOSUB Play_AP8_2                              ' #12
  PAUSE 12000

  Head = Spinning                               ' #13
  GOSUB Update_RC4
  PAUSE 7000

  Head = Stopped                                ' #14
  GOSUB Update_RC4
  PAUSE 9000

  Reagan = IsDown                               ' #15
  PAUSE 3000

  Bed = IsDown                                  ' #16
  GOSUB Update_RC4
  IZombie = IsOff                               ' #17

  PAUSE 30000

  GOTO Main


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

Play_AP8:
  SEROUT Sio, Baud, ["!AP8", %00, "P", sfx]
  RETURN

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

Play_AP8_2:
  SEROUT Sio, Baud, ["!AP8", %01, "P", sfx]
  RETURN

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

All_Off:
  OUTS = $0000
  relays = %0000

  ' drops through to Update_RC4, then RETURNs

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

Update_RC4:
  SEROUT Sio, Baud, ["!RC4", %00, "S", relays]
  RETURN


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