November 26, 2024, 04:51:23 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Prop-1, PIR, AP8 and I need to add the RC-4

Started by dvdbob, October 17, 2008, 10:33:09 PM

Previous topic - Next topic

dvdbob

October 17, 2008, 10:33:09 PM Last Edit: October 17, 2008, 11:06:44 PM by dvdbob
I'm reusing some code from a prior post and need to trouble shoot why the AP8 is only playing the first few seconds of the sample when the solenoid opens.  I would also like to add my RC4 into the mix and turn on a light and fogger.  I reviewed another post, but it involved servos - not yet :o.  The current code is a follows:

' =========================================================================
'
'   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...
'
'   {$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  Valve           = PIN0                  ' use OUT0


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

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

SYMBOL  Baud            = OT2400


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000001                              ' make P0 an output

  SEROUT Sio, Baud, ("!!!!!AP8", %00, "X")      ' stop if playing
  PAUSE 20000                                   ' PIR warm-up/show 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.2 sec input

  PAUSE 2000                                    ' hold 2 secs

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

  Valve = IsOn
  PAUSE 5000

  Valve = IsOff
  PAUSE 5000

  GOTO Reset


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


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


' -----[ User Data ]-------------------------------------------------------


gadget-evilusions

How long is your audio file? Looking at your program it seems to me it would play for 10 seconds while the solenoid fires, but after that 10 seconds it jumps to reset which stops the ap-8 from playing.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

livinlowe

I agree with Brian; your code will only fire the solenoid for 5 seconds (5000 ms) before it turns the solenoid off. What effect are you looking for?
Shawn
Scaring someone with a prop you built -- priceless!

dvdbob

The audio file is 6 seconds - "monster scream".  It plays fine when I fire it manually.  The effect I'm looking for is to boost the scare with audio and lights when my Prop jumps up from behind a small fence.

livinlowe

I wonder if maybe your solenoid is pulling so much current that it resets your prop-1. Do you know the electrical specifications on the solenoid?
Shawn
Scaring someone with a prop you built -- priceless!


livinlowe

Well, the solenoid is pulling 400 mA. Are you powering the AP-8 with its own PS or are you chaining off the prop-1?
Shawn
Scaring someone with a prop you built -- priceless!

dvdbob

Prop-1 and the AP-8 have their own separate power supplies.  When the trigger is activated, the beginning of the audio sample plays, maybe a second, while  the solenoid opens and holds for the 5 secs, resets, then waits again.

livinlowe

Well, then your Prop-1 isn't resetting. I had a AP-8 that I had to return, maybe your having the same problem.

Here is the link to my issues:

http://www.efx-tek.com/php/smf/index.php?topic=344.0
Shawn
Scaring someone with a prop you built -- priceless!

dvdbob

Thanks.  I have a second AP-8 that I will test.

JonnyMac

Isolate the problem before you swap parts.  If you take out the line that opens the valve will the audio play all the way through?
Jon McPhalen
EFX-TEK Hollywood Office