November 23, 2024, 10:11:10 PM

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.


Prop-1 to DC-16; getting select outs to Randomize/Flicker

Started by Natalie P, September 02, 2012, 01:20:12 PM

Previous topic - Next topic

Natalie P

Hey all,

After much researching and tinkering, I am not able to get what I need to work. 

I'm using the Prop 1, AP-8 and DC-16 to control ambient and effects lighting as well as sound for an entry room in a haunt.  All lights are 15mA LEDs running on the DC-16 board.  Outs 1- 8 are each connected to a single white LED which acts as ambient lighting and Outs 9-16 have two 15 mA LEDs to each out in amber or red light. 

When the board is powered, the white LEDs remain on.  When the trigger is pressed, these lights stay on and music begins. The music turns into static and these white LEDS start turning off until they're all out and the room is black.  The static turns to a ghostly voice which says "get out or I'll burn it down again!" 

- It all works fine up to this point -

The audio then changes to sudden burning and crackling fire.  What I need is to have Outs 9-16 start at the same time to simply flicker/flutter on and off to resemble fire and would need to continue for about 18 seconds.  So how does one assign the outs as a group to do this?

I reviewed the DC-16 docs and the Randomize example which shows this:

SEROUT Sio, OT2400, ("!DC16", %00, "R", 1) ' randomize OUT1
SEROUT Sio, OT2400, ("!DC16", %00, "RL") ' randomize OUT1..OUT8
SEROUT Sio, OT2400, ("!DC16", %00, "RH") ' randomize OUT8..OUT16
SEROUT Sio, OT2400, ("!DC16", %00, "RA") ' randomize OUT1..OUT16


Since I need Outs 9-16 to do this effect, I just tried throwing in the "("!DC16", %00, "RH")" example but it does nothing.  I've also read the "Power of RANDOM" thread but am unable to tell how to direct the code to just have this effect on Outs 9-16 .  Would anyone be able to lead me in the right direction as to how to do this?

If needed here, is my code that I have so far.  Kindly compose yourself before replying as I know it's primitive...I don't totally consider myself a noob, just a simple girl.  ;)

Any input is sincerely appreciated.


[font=courier]' =========================================================================
'   File....... Red Rose Gallery3-1.BS1
'   Purpose.....Fun!
'   Author..... Natalie P
'   Email.......nat
'   Started.....04/13/2012
'   Updated.....08/29/2012
'   {$STAMP BS1}
'   {$PBASIC 1.0}
' =========================================================================
' -----[ Program Description ]---------------------------------------------
'  Prop-1, AP-8 and DC-16 boards are used to create LED lighting and sounds
'  effects for room in a Victoria house. White ambient lights stay lit and
'  when the trigger is pushed it starts old time music.  As the music turns
'  into static, the white ambient lights turn off until the room goes dark.
'  The audio continues go fuzzy and you hear a ghostly voice speak, then
'  the amber and red lights turn on, reflecting and pictures and things in
'  the room to give the appearance of fire. The audio too changes into fire.
'
' Connections:
'   OUT16 --->    Light16                    ' Fire Lights 8
'   OUT15 --->    Light15                    ' Fire Lights 7
'   OUT14 --->    Light14                    ' Fire Lights 6
'   OUT13 --->    Light13                    ' Fire Lights 5
'   OUT12 --->    Light12                    ' Fire Lights 4
'   OUT11 --->    Light11                    ' Fire Lights 3
'   OUT10 --->    Light10                    ' Fire Lights 2
'   OUT9  --->    Light9                     ' Fire Lights 1
'   OUT8  --->    Light8                     ' Ambiant Light 8
'   OUT7  --->    Light7                     ' Ambiant Light 7
'   OUT6  --->    Light6                     ' Ambiant Light 6
'   OUT5  --->    Light5                     ' Ambiant Light 5
'   OUT4  --->    Light4                     ' Ambiant Light 4
'   OUT3  --->    Light3                     ' Ambiant Light 3
'   OUT2  --->    Light2                     ' Ambiant Light 2
'   OUT1  --->    Light1                     ' Ambiant Light 1

' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL  Trigger         = PIN6               ' Trigger w/SETUP in DN position
SYMBOL  Sio             = 7                  ' SETUP = out; no ULN
'
' -----[ Constants ]-------------------------------------------------------
SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0
SYMBOL  Baud            = OT2400              ' remove B/R jumper
'
' -----[ Initialization ]--------------------------------------------------
Reset:
  SEROUT Sio, Baud,("!DC16", %00, "S", %11111111, %00000000)
'
' -----[ Program Code ]----------------------------------------------------
Main:
  SEROUT Sio, Baud,("!DC16", %00, "S", %11111111, %00000000)
  IF Trigger = IsOn THEN Main

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)      'Command AP-8 to play

Start_Lighting:
  PAUSE 4950                                   'wait for old timey music to play out
  SEROUT Sio, Baud,("!DC16", %00, "S", %01011011, %00000000)  'Ambient lights (Out1-8)start turning off
  PAUSE 680
  SEROUT Sio, Baud,("!DC16", %00, "S", %01001010, %00000000)
  PAUSE 600
  SEROUT Sio, Baud,("!DC16", %00, "S", %00001000, %00000000)
  PAUSE 520
  SEROUT Sio, OT2400, ("!DC16", %00, "X")      ' All ambient lights are off
  PAUSE 5650                                   ' Ghost voice says "get our or I'll burn it down again!"

  ? ? ? ? ?                                                      ' Fire lights (Out9-16)begin to flicker

  GOTO Main[/font][/size]
[/size]

JonnyMac

I suspect you have a board with firmware pre version 1.5 where we added the randomizing commands.  We also fixed a bug that went undiscovered for quite a long time; this is a parser (serial command input) error that will clear OUT6 in the "S" and "L" commands, and OUT14 in the "S" and "H" commands.  Attached is a little demo I wrote for my friend at Disneyland (they used a lot of DC-16s when we had them) that adds a second command to fix this with the original firmware (Note: We offered a firmware update program for quite some time).

No worries, I have updated your program to add "fire" to the high outputs.  Give this a try.

I also upgraded your trigger input with debouncing to prevent false starts, especially if you're using a PIR.

' =========================================================================
'   File....... Red Rose Gallery3-1.BS1
'   Purpose.....Fun!
'   Author..... Natalie P
'   Email.......nat
'   Started.....04/13/2012
'   Updated.....08/29/2012
'   {$STAMP BS1}
'   {$PBASIC 1.0}
' =========================================================================

' -----[ Program Description ]---------------------------------------------
'  Prop-1, AP-8 and DC-16 boards are used to create LED lighting and sounds
'  effects for room in a Victoria house. White ambient lights stay lit and
'  when the trigger is pushed it starts old time music.  As the music turns
'  into static, the white ambient lights turn off until the room goes dark.
'  The audio continues go fuzzy and you hear a ghostly voice speak, then
'  the amber and red lights turn on, reflecting and pictures and things in
'  the room to give the appearance of fire. The audio too changes into fire.
'
' Connections:
'   OUT16 --->    Light16                       ' Fire Lights 8
'   OUT15 --->    Light15                       ' Fire Lights 7
'   OUT14 --->    Light14                       ' Fire Lights 6
'   OUT13 --->    Light13                       ' Fire Lights 5
'   OUT12 --->    Light12                       ' Fire Lights 4
'   OUT11 --->    Light11                       ' Fire Lights 3
'   OUT10 --->    Light10                       ' Fire Lights 2
'   OUT9  --->    Light9                        ' Fire Lights 1
'   OUT8  --->    Light8                        ' Ambiant Light 8
'   OUT7  --->    Light7                        ' Ambiant Light 7
'   OUT6  --->    Light6                        ' Ambiant Light 6
'   OUT5  --->    Light5                        ' Ambiant Light 5
'   OUT4  --->    Light4                        ' Ambiant Light 4
'   OUT3  --->    Light3                        ' Ambiant Light 3
'   OUT2  --->    Light2                        ' Ambiant Light 2
'   OUT1  --->    Light1                        ' Ambiant Light 1

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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' Trigger; SETUP = DN


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  lottery         = W0                    ' random value
SYMBOL   lottoLo        =  B0
SYMBOL   lottoHi        =  B1

SYMBOL  timer           = W5                    ' debounce and timing


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


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

Reset:
  SEROUT Sio, Baud, ("!DC16", %00, "S", %11111111, %00000000)
  SEROUT Sio, Baud, ("!DC16", %00, "P", 6, 1)


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  RANDOM lottery                                ' stir random
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)       ' Command AP-8 to play

Start_Lighting:
  PAUSE 4950
  SEROUT Sio, Baud, ("!DC16", %00, "S", %01011011, %00000000)
  PAUSE 680
  SEROUT Sio, Baud, ("!DC16", %00, "S", %01001010, %00000000)
  PAUSE 600
  SEROUT Sio, Baud, ("!DC16", %00, "S", %00001000, %00000000)
  PAUSE 520
  SEROUT Sio, OT2400, ("!DC16", %00, "X")
  PAUSE 5650

Fire_Lights:
  FOR timer = 1 TO 253                          ' 18s / 0.071s (71ms)
    RANDOM lottery                              ' stir random #

    ' commands to fix "gotcha" in "H" command in v1.0 firmware
    ' -- requres about 71ms to tx both commands

    SEROUT Sio, Baud, ("!DC16", %00, "H", lottoHi)
    SEROUT Sio, Baud, ("!DC16", %00, "P", 14, BIT13)    ' manually update OUT14
  NEXT

  GOTO Reset
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

BTW... don't be afraid of "white space" (blank lines, etc.) in your code. You do not make the program smaller by eliminating blank lines, you just make it harder to read!  ;)

The only thing downloaded to the Prop-1 is compiled operational code.
Jon McPhalen
EFX-TEK Hollywood Office