November 23, 2024, 02:15:33 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.


Another Thrashing Coffin

Started by FATMANJOE, October 20, 2008, 11:17:25 PM

Previous topic - Next topic

FATMANJOE

October 20, 2008, 11:17:25 PM Last Edit: October 21, 2008, 05:35:21 AM by FATMANJOE
I will be using four solenoids and two 2-stage pneumatic cylinders, one for the lid and the other for the bottom.  So what I would like to happen:
Trigger
Fogger on
Sound on
Light on
Trigger lid solenoid #1 for 5 seconds (open and close every 1/2 second)
Lid off
Trigger bottom soleniod #2 for 5 seconds (open and close every 1/2 second)
Bottom off
Trigger lid soleniod #3 for 5 seconds  (open and close every 1/2 second)
Lid off
Trigger bottom soleniod #4 for 5 seconds (open and close every 1/2 second)
Bottom off
Sound,fogger and light off

JonnyMac

I need more details...

How are you connecting to the fogger?
How are you connecting to the light?
What are you using to play sound?
Do you have two cylinders or one? 
Jon McPhalen
EFX-TEK Hollywood Office

FATMANJOE

Rc-4 for lights and fog
AP-8 for sound
Two cylinders the first stage is 11/2 inch stoke and the second stage is 3 inch stoke

JonnyMac

Okay, I'm a better programmer than mind reader!  ;D

I need you to describe the program operation in more detail -- or just differently so I can understand -- in order to get it right the first time.  I've been a bit under the weather so maybe that's it, but what you want is just not sinking in.
Jon McPhalen
EFX-TEK Hollywood Office

FATMANJOE

Sorry for the poor description
I have a prop-1, AP-8 and RC-4
The coffin will be using four solenoids on two pneumatic cylinders that have three ports. One port is the return, the second port has a short throw of 1½ inches and the third port has a throw of 3 inches. One cylinder is for the lid and the other is for the bottom.  The lid cylinder will have two solenoids hooked to it and the same for the bottom.  Maybe I read things wrong but I thought I could run a 110-volt fog machine and 110-volt light off of the RC-4 and sound from the AP-8 .
Trigger PIR
Sound on
Light and fog machine on
Solenoid  #1 will control the lid cylinder on and off for 5 seconds
Soleniod #2 will control the bottom cylinder on and off for 5 seconds
Soleniod #3 will control the lid cylinder on and off for 5 seconds
Soleniod #4 will control the bottom cylinder on and off for 5 seconds
Sound , light and fog off
Delay 1 minute before next activation

JonnyMac

October 23, 2008, 08:33:20 AM #5 Last Edit: October 24, 2008, 07:21:16 AM by JonnyMac
Are these all just random movements?

As far as fog, you'll have to hack into your remote.  In order to get on-demand control you need the fogger to be on and hot; the RC-4 acts like pressing the remote button.
Jon McPhalen
EFX-TEK Hollywood Office

FATMANJOE

Yes the on and off times can be random movements.
The garage of evil shows how to hack the control for the fogger
Thanks Jon for your time

JonnyMac

Okay, I think I finally understand what you've got.  Give this program a try:

' =========================================================================
'
'   File...... Thrashing_Coffin.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... 24 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  LidDown         = PIN3
SYMBOL  LidUp           = PIN2
SYMBOL  BoxDown         = PIN1
SYMBOL  BoxUp           = 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  relays          = B0
SYMBOL   Fogger         =  BIT0                 ' use K1
SYMBOL   Light          =  BIT1                 ' use K2

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


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

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

  SEROUT Sio, Baud, ("!!!!!AP8", %00, "X", "!RC4", %00, "X")
  PAUSE 60000


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

Main:
  timer = 0                                     ' reset timer

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, "P", 0)       ' start audio

  Fogger = IsOn
  Light = IsOn
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)

  timer = 0

Shake_It:
  RANDOM lottery
  BoxUp = lottery                               ' randomize
  BoxDown = 1 - BoxUp                           ' make opposite of BoxUp
  RANDOM lottery
  LidUp = lottery                               ' randomize
  LidDown = 1 - LidUp                           ' make opposite of LidUp
  RANDOM lottery
  delay = lottery // 101 + 100                  ' 0.1 to 0.2 seconds
  PAUSE delay
  timer = timer + delay
  IF timer < 5000 THEN Shake_It
    GOTO Reset


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


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

FATMANJOE

Code works great and I love the random action but I need to make a change and
drop two solenoids from the program.  So I only need the box up and lid up
with random operation but with the same time duration as with all four solenoids.
                                                              Thanks Joe

JonnyMac

Do me a favor please, Joe, don't make me work so hard.   ;D   It's two days before Halloween and things are ballistic.  I don't want to have to go back through an old program, decode it, and fix it.  Please just post a new request with what you have (IO connections -- and please name them for me so I can write "nice" code) and how you want everything to operate.

Thanks for understanding.
Jon McPhalen
EFX-TEK Hollywood Office