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


need a code

Started by reddragon, October 21, 2008, 07:24:49 PM

Previous topic - Next topic

reddragon

 i am using some old driving lights that i what to flicker for 20 sec and then i have two air powered props that need air on for 4 sec each and then my fogger that can run for 20 sec and then need to stop and reheat for 5 min then i have a talking head that i would like to have on for 5min and then turn off and would like have everything be side lights be randomized if that can be wrote that would be one last thing stoping me

JonnyMac

Details, details, details....

When you write in one big run-on sentence like that I can't understand.  Please help me help you by taking a little more time and being more explicit with your description.
Jon McPhalen
EFX-TEK Hollywood Office

reddragon

 Sorry here is what im whating to do
> lights come on and fiicker for about 20 sec.
(randomize)
>>>> after trigger<<<<<
>  grave jummper  for 4 sec.
>  dead man  for 10 sec.
>  fogger  for  20
>  coffin for 4 sec.
>  fan for 3 sec.
and repeat 2 times then wait for trigger

JonnyMac

You are still giving me very little to work with....  ???

Q :: What does "grave jumper for 4 sec." actually mean?  Does it mean to turn on this output?
Q :: Do the items in your list run sequentially, or at the same time?
Q :: What controller will these run on?

As you can see, describing a program to someone else can be challenging -- which is a great reason to learn programming!   ;D
Jon McPhalen
EFX-TEK Hollywood Office

reddragon

 sorry jon i was trying to two things at once sorry about that... 8)
>the 4 sec is the time on for that prop.
>they are controld my prop1 controler.
>they are ran sequentially. 
im still trying to learn how to write and read codes i have been the one two build props and now im trying to do it all..lol

JonnyMac

We're getting closer but I still don't understand the situation with the lights.  Are the lights supposed to flicker before the trigger or after?
Jon McPhalen
EFX-TEK Hollywood Office

reddragon

 I'll remember to give more details on more post in the years to come sorry Jon

//////////////////  After the trigger is tripped///////////////////////////////////////
> I am whating the lights to be on for 20sec. and wile they are on i would like them to flicker on and off and then stay on
  (Randomized order)
> Then run through the following
> Grave jumper  come on and stay on for 5 sec. then turn off
> Coffin come on and stay on for 5 sec. then turn off
> Fogger come on and stay on for 30 sec. then turn off
> Fan come on and stay on for 20 sec. then turn off
> Dead man come on and stay for 20 sec. then turn off
> repeat for 2 times and then goto main


JonnyMac

This is tricky program -- not for beginners!  ;)  I hope it does what you want....

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


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


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Lights          = PIN5
SYMBOL  DeadMan         = PIN4
SYMBOL  Fan             = PIN3
SYMBOL  Fogger          = PIN2
SYMBOL  Coffin          = PIN1
SYMBOL  GraveJumper     = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  idx             = B0
SYMBOL  cycles          = B1
SYMBOL  last            = B2
SYMBOL  mask            = B3
SYMBOL  check           = B4
SYMBOL  playList        = B5
SYMBOL  delay           = W3
SYMBOL  timer           = W5
SYMBOL  lottery         = W6


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

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


' -----[ 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

  Lights = IsOn
  timer = 20000

Lights_On:
  RANDOM lottery
  delay = lottery // 2501 + 1000                ' 1 to 3.5 seconds
  IF delay < timer THEN Flicker_Delay
    delay = timer

Flicker_Delay:
  PAUSE delay
  timer = timer - delay
  RANDOM lottery
  idx = lottery // 3 + 1                        ' 1 to 3 flickers

Flicker:
  Lights = IsOff
  PAUSE 100
  Lights = IsOn
  PAUSE 50
  IF timer < 200 THEN Run_Sequence
  timer = timer - 150
  idx = idx - 1
  IF idx > 0 THEN Flicker
  GOTO Lights_On

Run_Sequence:
  Lights = IsOn
  cycles = 0

Select_PopUp:
  RANDOM lottery                                ' re-stir random #
  idx = lottery // 5                            ' select, 0..4
  IF idx = last THEN Select_PopUp               ' no repeats
    last = idx                                  ' save for next cycle
  READ idx, mask                                ' convert to bit mask
  check = playList & mask                       ' check play list
  IF check <> %00000000 THEN Select_PopUp       ' try again if played
    playList = playList | mask                  ' mark play list
    IF playList <> %00011111 THEN Run_PopUp     ' finished?
      playList = %00000000                      ' yes, reset

Run_PopUp:
  BRANCH idx, (Run_Grave, Run_Coffin, Run_Fog, Run_Fan, Run_Man)
  idx = 0

Run_Grave:
  GraveJumper = IsOn
  PAUSE 5000
  GraveJumper = IsOff
  GOTO Update_Cycles

Run_Coffin:
  Coffin = IsOn
  PAUSE 5000
  Coffin = IsOff
  GOTO Update_Cycles

Run_Fog:
  Fogger = IsOn
  PAUSE 30000
  Fogger = IsOff
  GOTO Update_Cycles

Run_Fan:
  Fan = IsOn
  PAUSE 20000
  Fan = IsOff
  GOTO Update_Cycles

Run_Man:
  DeadMan = IsOn
  PAUSE 20000
  DeadMan = IsOff
  GOTO Update_Cycles


Update_Cycles:
  IF playList <> %00000000 THEN Select_PopUp    ' only on new cycle
    cycles = cycles + 1
    IF cycles = 2 THEN Reset
    GOTO Select_PopUp



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


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

Bit_Mask:
  EEPROM (%1, %10, %100, %1000, %10000)
Jon McPhalen
EFX-TEK Hollywood Office

reddragon

it will do jest as we talked thank you so much for helping a newbe.