May 18, 2024, 11:47:11 PM

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.


I need a program

Started by confused, October 03, 2007, 09:58:19 AM

Previous topic - Next topic

confused

I need a program to run a basic coffin jumper prop

I need 1 cylinder to activate along with a light and sound that will raise the prop the light and sound will stop. cylinder 1 needs to hold for the duration

I need cylinder 2 to activate along with light and sound then both cylinders retract and wait

I have your prop 1 strater kit, a pir sensor and an ap 8

I would like some randomization in the timing of the cylinders and the sound ( I still have not figured out the ap8 or audacity program)

thank you Chris

JonnyMac

October 03, 2007, 10:05:26 AM #1 Last Edit: October 03, 2007, 10:09:16 AM by JonnyMac
Do you have multiple sounds in the AP-8, or just one long sound that you'd like to cut-off at some point?  The coding is a bit different for each of these scenarios.  Let me know and I'll whip up a program.

And... what kind of light are you using?  If 120 VAC you'll need a relay connected to the Prop-1 to control it -- the Prop-1 cannot switch 120 VAC circuits.

Finally: Be patient with yourself; you just got your product yesterday, right?  I'm good at this because I've been doing it my whole life; don't worry, it doesn't take a lifetime to learn, in a week or so (with a bit of effort on your part) you'll get it all sorted out.
Jon McPhalen
EFX-TEK Hollywood Office

confused

I will probably have the same sound(creaking door like sound) during cylinder 1 operation when the prop stands up but I think I would like to have different sounds(various taunts) during cylinder 2 operation when prop springs forward

I have not yet figured out the audacity program yet but I am working on it

yes I have relays to activate 120v lights (is it wrong to have the prop1 activate a the relay light as strobe effect or is it better to  simply have it turn on a strobe light)


thank you

JonnyMac

Chris,

I'm still at a loss as to how you want to prop to behave.  I'm assuming that you want to wait for signal from the PIR, then activate the prop -- but how, exactly?  What I'm confused about is the two cylinders... what does each of them do?  I'm certain that one is the lifter, but what about the other?  Is it the lid?  If so, should the sequence be something like:

-- wait for PIR
-- start audio
-- open lid
-- lights on
-- lift prop
-- delay
-- lower prop
-- close lid
-- reset

I'm sorry to be nit-picky but that's really important with programming; as humans, we're really good at making sense of partial information in our language, but computers can not do this -- they need absolute specifics.
Jon McPhalen
EFX-TEK Hollywood Office

confused

sorry about the bad description

what I am going to have is a coffin with body in it when the pir detects victim the body is going to rise up to a standing position (some randomization of time would be good) that will be cylinder 1, sound 1, and light1

while the prop is standing and after a random pause the upper torso and arms are going to spring forward that will be cylinder2 ,random sound2 and light effect 2(possibly a strobe) then all will retract and wait

I hope that makes more sense

thanks chris

JonnyMac

Okay, we're getting there.  How long are the random pauses?  From what minimum value to what maximum value?  I need these numbers to include in the code (which is mostly finished).

The devil is always in the details, and we need to know every aspect of a prop's operation before we can code it.
Jon McPhalen
EFX-TEK Hollywood Office

confused

We should probably have a random pause of about 5 to 10 seconds once the pir has detected someone before the first set of effects

then a random pause of say 2 to 6 seconds while the prop simply stands there before the second set of effects fire and the torso jumps and screams etc.

also we should probably have a pause of say 1 to 2 minutes  between retraction and the next time the prop is ready to go again so it is not constantly cycling and the area the pir is sensing has a chance for the people to clear out. I suppose that timing could be a constant since it would be fairly long

I am hoping that when I see this program it will make more sense to me and perhaps I will be able to tweak any timing  problems my self with out bothering you

thanks again chris

confused

We should also make sure that the torso fully retracts (that would be the second set of effects) before the the prop lies back down (that would be the first set of effects) so it does not conflict with the coffin

or another way to put is that it needs to finish in reverse order of how it started

I hope this makes sense

JonnyMac

More details?  How many sounds are you going to have?  The AP-8 can hold eight -- seven that are 6 seconds long, and one that is 15 seconds long.  Since you want to select a random sound, I need to know the selection range.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

October 05, 2007, 01:59:36 PM #9 Last Edit: October 14, 2007, 08:36:46 AM by JonnyMac
Here's a program that should work -- with detail tweaks:

Program updated 10/14/07

' =========================================================================
'
'   File...... Coffin_Lift.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2007 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                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  Light2          = PIN3                  ' OUT3 = light 2 relay
SYMBOL  Light1          = PIN2                  ' OUT2 = light 1 relay
SYMBOL  Torso           = PIN1                  ' OUT1 = torso valve
SYMBOL  Body            = PIN0                  ' OUT0 = body valve


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

SYMBOL  Baud            = OT2400

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  status          = B0                    ' AP-8 status
SYMBOL   playing        = BIT7

SYMBOL  sfx             = B2                    ' sound to play
SYMBOL  last            = B3                    ' last played
SYMBOL  timer           = W4                    ' for timing and delays
SYMBOL  lottery         = W5                    ' random value


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

Reset:
  PINS = %00000000                              ' clear outputs
  DIRS = %00001111                              ' set output pins (P0..P2)

  SEROUT Sio, Baud, ("!!!!!!!AP8", %00, "X")    ' stop audio if playing
  GOTO Show_Delay


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

Main:
  RANDOM lottery                                ' stir random value
  PAUSE 10
  timer = timer + 10 * PIR                      ' advance/clear timer
  IF timer < 250 THEN Main                      ' wait for valid signal

  timer = lottery // 5001 + 5000                ' delay 5 to 10 secs
  PAUSE timer

  Body = IsOn
  Light1 = IsOn
  sfx = 0
  GOSUB Play_Sound

  RANDOM lottery
  timer = lottery // 2001 + 2000                ' delay 2 to 4 secs
  PAUSE timer

  Torso = IsOn
  Light2 = IsOn
  GOSUB Play_Random_Sound

  RANDOM lottery
  timer = lottery // 4001 + 2000                ' delay 2 to 6 secs
  PAUSE timer

  Light2 = IsOff
  Torso = IsOff
  PAUSE 1500                                    ' allow retraction
  Light1 = IsOff
  Body = IsOff

Show_Delay:
  PAUSE 60000                                   ' one minute
  timer = 0                                     ' clear for PIR debounce
  GOTO Main


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

Play_Random_Sound:
  RANDOM lottery
  sfx = lottery // 8                            ' pick sound, 0 to 7
  IF sfx = last THEN Play_Random_Sound          ' no repeats!

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

Play_Sound:
  SEROUT Sio, Baud, ("!AP8", %00, "P", sfx)
  last = sfx                                    ' save for next time

Let_Sound_Finish:
  PAUSE 100
  SEROUT Sio, Baud, ("!AP8", %00, "G")          ' get status
  SERIN  Sio, Baud, status
  IF playing = Yes THEN Let_Sound_Finish
  RETURN


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

confused

I 'm guessing now because I still have not figured out the audacity program

I think the first sound effect for cylinder 1 (standing the prop up) will prabably be the same every time some sort of creaking rattle and happen again when the prop retracts

so lets figure that is one 6 second  piece we are left with 6 if I can figure  out the program there is no reason why I cant come up with 6 evil laughs screams or taunts so let say 6 and we wont worry about the 15 second thing this time

by the way please excuse any of this that is misspelled or does not make sense as i am drunk now





JonnyMac

I updated the program so that it starts with sound #0, the randomly chooses one of the others for the second part of the program.
Jon McPhalen
EFX-TEK Hollywood Office

confused

I'm sorry guys but I can't get this program to run

JonnyMac

Grab the program again -- when I updated it I accidentally introduced a sneaky little bug that is hard to find; but I found it and removed it.  I've just tested the program on my desk and it is now working again.  Sorry about the trouble.
Jon McPhalen
EFX-TEK Hollywood Office

confused

loaded it up and tried again but it is not working correctly 

p0 and p2 come on and stay on that is all it does