November 23, 2024, 05:52:38 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.


Prop 1, AP 8, for the electric chair

Started by Shotzie, October 03, 2008, 05:57:33 PM

Previous topic - Next topic

Shotzie

Hey Jon,
I have a Prop 1, and an AP 8 (as soon as I receive it that is).  My project is an electric chair, it has a 6 inch travel cylinder.  What I am wanting to do is...
I want the prop triggered by push button.  When triggered I want the the victim to lean forward and speak.  Victim sits back as laughter starts.  Light goes out, victim screams.  Strobe starts as victim starts to thrash with electric sounds and smoke blows.  then it all stops and voice says "your next" then lights come on and prop resets.
Thanks in advance for your help.

JonnyMac

Okay, I'm happy to help but there are too many unknowns at the moment.

Q: Are you using separate audio clips for speak, laugh, scream, and thrash (electric)?
    -- please zip the audio you're intending to use and attach it to your response (I need it for timing)

Q: How are you controlling the light, strobe, and fog? -- I'm assuming through relays at the moment


Programming is easy -- when you know all the details.  I've got a program started for you but will need these questions answered before I can finish.

Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Ok, I wasn't sure if you needed the clips.  I am still working on the sounds (I am having to actually custom make them).  Yes I am using mechanical relays for the strobes, lights, etc. 

Thanks

Shotzie

October 13, 2008, 11:21:10 PM #3 Last Edit: October 13, 2008, 11:25:53 PM by Shotzie
Jon,
I am still working on the sounds.  I will get them to you as soon as I can.
Oh yeah, the lights are 3 LEDs that will run from 12v, strobe, fog and air valve are all being run by separate relays.
Thanks
Paul

JonnyMac

What I really need to know is the length of each sound and what slot you're using (for each) in the AP-8.
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Jon,

I sent you an email to the address listed on the forum.  The air piston I am using is a 6" stroke if that helps.

Thanks

JonnyMac

October 21, 2008, 01:45:32 PM #6 Last Edit: October 21, 2008, 05:29:43 PM by JonnyMac
Okay, give this a try.  Note that the listing contains the AP-8 slot assignments for your files -- you must put the files in the slots as shown for this to run correctly.  After you've put your sounds into the AP-8 be sure to return all L210 switches to the Open position.

' =========================================================================
'
'   File...... Shotzie_Chair.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 21 OCT 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' AP-8 Slot allocation:
' -- O = Open
' -- X = Closed
'
' Slot   L  2  1  0   file
' ----   -  -  -  -   -------------
'   0    O  X  X  X   scream
'   1    O  X  X  O   youre_next
'   2    O  X  O  X   electrocution
'   6    O  O  O  X   ntc


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Smoke           = PIN3                  ' fogger control
SYMBOL  Strobe          = PIN2
SYMBOL  Valve           = PIN1
SYMBOL  Lights          = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  status          = B0
SYMBOL   playing        =  BIT7

SYMBOL  sfx             = B2                    ' sound segment

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


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

Reset:
  PINS = %00000001                              ' start with lights on
  DIRS = %00001111                              ' set outputs

  SEROUT Sio, Baud, ("!!!!!!AP8", %00, "X")     ' kill sound on hard reset


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

Main:
  timer = 0                                     ' reset timer for trigger

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  Valve = IsOn                                  ' lean forward
  sfx = 6                                       ' speak (ntc)
  GOSUB Play_AP8
  PAUSE 11000                                   ' almost to end

  Valve = IsOff                                 ' sit back
  PAUSE 1000

  Lights = IsOff
  PAUSE 500

  sfx = 0                                       ' scream
  GOSUB Play_AP8
  GOSUB Wait_AP8

  SEROUT Sio, Baud, ("!AP8", %00, "L", 2, 2)    ' loop twice
  timer = 0
  Strobe = IsOn

Thrash:
  Valve = 1 - Valve                             ' toggle valve position
  RANDOM lottery
  delay = lottery // 401 + 25                   ' 25 to 425 ms
  PAUSE delay
  timer = timer + delay

Check_Smoke:
  IF timer < 2000 THEN Thrash                   ' smoke after 2 seconds
    Smoke = IsOn

Check_Done:
  SEROUT Sio, Baud, ("!AP8", %00, "G")          ' adds about 100 ms
  SERIN  Sio, Baud, status
  IF playing = Yes THEN Thrash

  Valve = IsOff
  Strobe = IsOff
  Smoke = IsOff
  PAUSE 1000

  sfx = 1
  GOSUB Play_AP8                                ' you're next
  GOSUB Wait_AP8

  PAUSE 5000
  GOTO Reset


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

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

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

Wait_AP8:
  PAUSE 70
  SEROUT Sio, Baud, ("!AP8", %00, "G")
  SERIN  Sio, Baud, status
  IF playing = Yes THEN Wait_AP8
    RETURN

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


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

Shotzie

Thanks, Looks great.  However I am not seeing where the strobe turns on. If I am just not seeing it great if it is not there just tell me where and how to put it in and I will fix it.

Thanks
Paul

JonnyMac

Sorry, I thought I had it in -- was miscounting how many lights were active on my setup.  It's activated right before the Thrash section.
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Ok thanks for your help. One last question (for now anyway) which chip do I need to use with prop 1?

JonnyMac

Do you mean ULN2803 versus ULN2003?  No matter what, you must remove the ULN influence from P7 so that the Prop-1 can communicate with the AP-8 and other serial devices.  See this thread:

http://www.efx-tek.com/php/smf/index.php?topic=130.0
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Ok thanks, that is what I thought but I couldn't find the place I saw the modification.  Hopefully I have it figured out but I'm sure I will have other questions.

JonnyMac

Be sure to read the docs and give yourself time to experiment.  You wouldn't rebuild an engine without doing a few tune-ups first, right?  ;)
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Ok Jon,
As promised I have more questions.
On the Prop-1 setup on P7 and P8 up or down?
AP-8, the DIP switches are O=down? And finally, when using should all switches DIP switches up or down?

Thanks again,
Paul

JonnyMac

SETUP jumpers: It says right in the listing! -- did you not read it?  ;D  P7 is out and P6 is down.

On the AP-8 Open is *usually* down, but if the switch was installed upside down that will not be the case.  You have to look at the switch; once side should say OPEN.  When all your sounds are programmed into the AP-8 you need to move all four switches to the OPEN position.
Jon McPhalen
EFX-TEK Hollywood Office