November 22, 2024, 11:17:16 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Pulsing Fog Machine with Prop 1

Started by Lindiur, October 19, 2009, 05:10:38 PM

Previous topic - Next topic

Lindiur

Greetings all.
Is there a way to trigger the fog machine on a continuous pulse even though the prop 1 hasn't been triggered with the PIR. The reason is the fog machine in use does not have a timer for it so i thought the prop 1 could be the timer and the trigger for the prop as well. I would like the fog machine to be pumping fog though the PIR hasn't been triggered. If there is could someone maybe show me a sample code or something. Any suggestions would be great.

Thanks
Lindiur

JonnyMac

That's actually much more complicated than you think -- you have to create a multi-tasking program.  If you give me a specific requirement that uses the pulsing fogger I'll see what I can do about a program for you.
Jon McPhalen
EFX-TEK Hollywood Office

Lindiur

Thanks Jon!

Well as I wrote before I have a drop down panel in a cemetery pillar entrance which you wrote a program for, thanks by the way, well in the other pillar I would like to put a fog machine but I want the fog machine to go off randomly for 10 seconds every 1 to 2 minutes as well as go off when the PIR is triggered. Is that considered pulsing, either way it seems tricky to me. Also is there a special relay you need for the fog machine.

Here is the program for the Panel if its needed.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated... 11 OCT 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  CARP            = PIN5                  ' V+/OUT5 to V-Trig @ 12v

SYMBOL  Light           = PIN2
SYMBOL  DoorDown        = PIN1
SYMBOL  DoorUp          = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000001                              ' start with door up (OUT0)
  DIRS = %00100111                              ' set output pins (1s)

  PAUSE 30000                                   ' PIR 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

  DoorUp = IsOff
  DoorDown = IsOn
  PAUSE 100                                     ' let door drop

  CARP = IsOn                                   ' start audio
  PAUSE 500
  CARP = IsOff

  Light = IsOn
  PAUSE 10000                                   ' run for 10 seconds

  GOTO Reset


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


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


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

Once again thank you for everything.
Lindiur.

JonnyMac

I had to think about this a couple times -- this was the easiest version I could come up with.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated... 20 OCT 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  CARP            = PIN5                  ' V+/OUT5 to V-Trig @ 12v

SYMBOL  Fogger          = PIN3
SYMBOL  Light           = PIN2
SYMBOL  DoorDown        = PIN1
SYMBOL  DoorUp          = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2
SYMBOL  idx             = B3

SYMBOL  holdoff         = W3                    ' in 100ms increments
SYMBOL  fogTimer        = W4                    ' in 100ms increments
SYMBOL  lottery         = W5


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

Reset:
 PINS = %00000001                              ' start with door up (OUT0)
 DIRS = %00101111                              ' set output pins (1s)

 holdOff = 200                                 ' 20s before next retrigger
 fogTimer = 300                                ' start with 30s


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

Main:
 timer = 0                                     ' reset timer
 FOR idx = 1 TO 20
   RANDOM lottery
   PAUSE 5                                     ' loop pad
   timer = timer + 5 * Trigger                 ' update timer
 NEXT

Check_Fog:
 IF fogTimer < 100 THEN Update_Fog             ' fog timer expired?
   fogTimer = fogTimer - 1                     ' no update
   GOTO Check_Holdoff                          ' ready for re-trigger

Update_Fog:
 Fogger = 1 - Fogger                           ' togger fogger output
 IF Fogger = IsOff THEN Fog_Off

Fog_On:
 fogTimer = 100                                ' 100 x 100ms = 10s
 GOTO Check_Holdoff

Fog_Off:
 fogTimer = lottery // 601 + 600               ' 1 to 2 minutes

Check_Holdoff:
 IF holdoff = 0 THEN Check_Trigger
   holdoff = holdoff - 1
   GOTO Main

Check_Trigger:
 IF timer < 100 THEN Main

Run_Show:
 DoorUp = IsOff
 DoorDown = IsOn
 PAUSE 100                                     ' let door drop

 CARP = IsOn                                   ' start audio
 PAUSE 500
 CARP = IsOff

 Fogger = IsOn
 Light = IsOn
 PAUSE 10000                                   ' run for 10 seconds

 GOTO Reset


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


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


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