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


Prop 1, AP 8, for the electric chair

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

Previous topic - Next topic

Shotzie

Thanks for your help. I totally overlooked it (I didn't think to look there but now I know).

Shotzie

Ok, I finally have everything wired and figured out my little problems.  Tomorrow I am going to test the whole shooting match.  So far so good.

JonnyMac

It worked on my desk -- no reason it shouldn't work for you!  ;)
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Well that's the kind of luck I normally have. But I hooked everything up and it works great. Thank you very much for all your help.

JonnyMac

You selected EFX-TEK -- your luck must be changing for the better!   ;D
Jon McPhalen
EFX-TEK Hollywood Office

Shotzie

Jon,

Ok using the code from this thread I need to do some changes.  I tried myself but with undesirerable results.  I need to remove the first part where he leans forward and says "not the chair", and the scream.  I would like it to start thrashing and with the electric sound and the smoke to start after a second.

PLEASE HELP!

JonnyMac

It's a new project, so start a new thread.  Please explain what you DO want, not what you DON'T want.  I'd rather write a program from scratch than wade through something else and change it.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

 Give this a try.



'   {$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

  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 < 1000 THEN Thrash                   ' smoke after 1 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

Shotzie