November 23, 2024, 05:43:19 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.


Running sequential flickerings lights

Started by imagineerdan, March 13, 2009, 03:00:03 PM

Previous topic - Next topic

imagineerdan

I am looking for something similar to the function of the fading running lights thread posted earlier. How would the code look for flickering a pin at a time in succession. Basically merging the candle flicker code with a sequential running lights code?  with both the flicker rate and the pin sequince speed being an adjustable variable.

Thanks!

JonnyMac

Call me stupid (many do), but I'm still not getting an idea of what this should look like visually.  Please try to describe it again without reference to anything else; I may be confused by the old program (which uses PWM and can't be mixed with flickering).  Sorry to be so dense, we are up to our eyeballs in alligators getting things ready for Transworld.
Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

No worries! Im am trying to make pin1 turn on and flicker like and candle, then turn off and pin2 to turn on and flicker like a cable etc etc... So it would be like a chase but instead of just turning each pin on then off, Each pin would flicker for 2 seconds then turn off to let the next pin flicker for two seconds.


But

I am trying to do this with adjustable variables

1) from which pin to which pin flickers. Say loop between pin0 and pin2.

2) and how long each pin stays on flickering

3) as well as a variable to raise or lower the level of flicker

JonnyMac

Okay, let's see if this is what you're looking for:

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


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


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


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


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

SYMBOL  FIRST_PIN       = 0
SYMBOL  LAST_PIN        = 7


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

SYMBOL  pinNum          = B2
SYMBOL  idx             = B3
SYMBOL  level           = B4

SYMBOL  lottery         = W5


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

Reset:
  DIRS = %11111111                              ' set outputs

  pinNum = FIRST_PIN


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

Main:
  IF pinNum > LAST_PIN THEN Reset

Flicker_Pin:
  FOR idx = 1 TO 100
    RANDOM lottery
    level = lottery
    PWM pinNum, level, 4                        ' 5ms x 4 x 100 = 2sec
  NEXT
  LOW pinNum

  pinNum = pinNum + 1
  GOTO Main


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


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

imagineerdan

Wonderfully perfect john, sorry for my cryptic descriptions at first! Great luck at the convention, Booooooo!