November 23, 2024, 01:35:49 AM

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.


Pop-up Program - Prop-1, PIR, AP-8 & RC-4

Started by dvdbob, October 29, 2008, 09:33:53 AM

Previous topic - Next topic

dvdbob

Jon,

I have tried to hack a program together utilizing the existing code you have created for others, but still do not have it working right.

Description:

PIR - 'Victim triggers the PIR
3 second pause
PopUp - 'activate a 12v solenoid (Hold for 6 seconds)
LED Lights on - '(Monster Eyes)
at the same time turn on two lights and a fogger RC-4 (Strobe, Fogger & Flood Light) and a single 6 second SFX (Scream) AP-8
reset and hold for 15 seconds.

I appreciate the help.


JonnyMac

Try this:

' =========================================================================
'
'   File......
'   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... 29 OCT 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Eyes            = 1
SYMBOL  PopUp           = PIN0


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

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

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  relays          = B0
SYMBOL   Strobe         =  BIT0
SYMBOL   Fogger         =  BIT1
SYMBOL   Flood          =  BIT2

SYMBOL  status          = B1
SYMBOL   playing        =  BIT15

SYMBOL  timer           = B2
SYMBOL  level           = B3


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000011                              ' set outputs

  SEROUT Sio, Baud, ("!!!!!AP8", %00, "X", "!RC4", %00, "X")
  relays = %0000

  PAUSE 15000                                   ' warm-up/delay


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

Main:
  timer = 0                                     ' reset timer

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

  PAUSE 3000

  PopUp = IsOn
  PAUSE 5000

Fade_Eyes_On:
  FOR level = 0 TO 255 STEP 5
    PWM Eyes, level, 4
  NEXT
  HIGH Eyes                                     ' leave on after PWM

Audio_On:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)

Relays_On:
  relays = %0111                                ' strobe + fog + flood
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)

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

  GOTO Reset                                    ' all off


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


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


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

dvdbob

Jon,

Thank you.  With some tweaking on the timing it works.  Except for the LEDs.  Do I hook this up to the pin headers or the terminal block?

JonnyMac

You can use either, depending on the how much current you want to pump through the LEDs (limit to 10mA if using a Px.W output).  I just re-ran your program and the eyes output works on my desk -- check your connections.
Jon McPhalen
EFX-TEK Hollywood Office

livinlowe

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