November 23, 2024, 02:22:55 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.


Chaser Lights Programming--EFX video shot by Vern Graner

Started by jukingeo, September 10, 2007, 07:14:37 AM

Previous topic - Next topic

jukingeo

Hello Jon (and all)

As I said, I started to do work with the Prop-2 today.  As they say, "so far so good".  I tried playing around with the programs that I downloaded from the Prop-2 documentation page.

I have not done much with the programs, but recognizing the FOR NEXT loops from my old programming days, I decided to play with those first.  I mostly altered the timing of the programs to get a different effect.

Ok, the next thing I would like to do is make a more eleaborate chaser in which I can chase more than one lamp at a time.  For instance, the program that comes with the Prop-1 Trainer documentation I could use.  However, as we talked about before, this program needs to be altered.  I know the Symbol commands have to be changed, but to what?  Also what else would have to be changed in this particular program to get it running.

Once I have the program running, I am probably going to build on it.  For one, I would like the button to cycle through different program 'sets'.  Also I would even like to create a timed set and then have the program change the set automatically...much like a theatre marquee would do.  Since I only have the one pot for now, after I use the control as a speed control, I was thinking that it would be also cool to change the control's function to allow the timing of the 'set' to be changed (meaning use a constant speed, but manually alter the time between different set chasing patterns).

Overall, I have seen that this board is pretty versitile and while it cannot multi-task as the SX can, I sure can see quite a few uses here already.

For one, I saw that one of the programs allows a trigger, but then doesn't allow another triggered event to occur until 20 seconds later.  THAT is way cool.  I notice that many haunt operators have trouble with this problem at their haunts in which kids constantly retrigger an event (once they have an idea where the trigger is).  So that program would nicely prevent that.

I can see what the Stamp enthusiasts say that programming is much easier with a Stamp.  I couldn't believe how easy and how fast it was just to make minor alterations in the program and then have the new program replace the old one.  VERY fast!

Thanx for the input & help.

It was a pretty fun evening thusfar!

Geo

JonnyMac

And you're just getting started... wait until you discover the power of RANDOM! -- lots of fun, especially in Halloween props.
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

September 16, 2007, 11:22:44 AM #17 Last Edit: September 16, 2007, 02:23:59 PM by jukingeo
Quote from: JonnyMac on September 15, 2007, 08:48:41 PM
And you're just getting started... wait until you discover the power of RANDOM! -- lots of fun, especially in Halloween props.

OK...enlighten me :).   I am familiar with the standard form of RANDOM from 'regular' basic, but I would be curious on how to use with the Prop-2 and how it could be adapted to haunts.

One thing I can think of is perhaps using RANDOM for a 'candle' flicker type effect.  I know that there are devices for this effect on the market already, but with the Prop-2's 16 outputs it would be WAY more cost effective to use the Prop 2 instead and just hook it up to a bunch of LED's.

Another thing...Could you use RANDOM within a chaser program to choose a random output channel to light up?  This could create a cool random twinkling effect.



Thanx,

Geo

JonnyMac

Geo,

We've had these forums up a while -- I've written plenty about RANDOM, starting here:

http://www.efx-tek.com/php/smf/index.php?topic=41.0

In the future, please restrict your threads to a single topic -- this thread has become Jon coaching Geo which is okay (I'll coach anybody), but makes searching by others impossible because its a tread with a multitude of topics; let's restrict threads to a single topic.  Got a new question?  Start a new thread, please, otherwise, our forums will become useless except to those who have hours of time to read every thread looking for specific information.  I don't have that kind of time (especially this time of year); do you?
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

OK, thanx for the info on Random.

Sorry about the stacking of topics.  As you can pretty much tell I am pretty much in sensory overload right now and so far I been having a good time with the board and most of my alterations to the programs you presented have been working great.  So I am excited to take things to the next level.

I will put the last part of that post in a new topic.  I am sure too there are others that may want to know on how to 'trick' the Prop 2 into thinking it is doing more than one task at a time.

Geo

jukingeo

Hello All,

I have been learning quite a bit about the Prop 2 these past couple weeks and thanks to Jon (and the documentation over at Parallax) I am beginning to create my own programs.

I revisited one of my favorite programs that Jon wrote for me and I made some cool updates on it.  Originally this program is in the 'Cylon Eyes' post I made, but I felt it belong here under my original Chaser Lights Programming post.

Anyway, this program will allow you to program 7 patterns into the Prop-2 and will chase 6 channels.

The 'data bank' towards the end is the business end of the program and altering these 0's and 1's will turn on and off pins 8 - 13 on the Prop-2.  These pins were chosen because Jon originally wrote the program so it will work with the Prop-1 trainer board.  Exploiting the trainer board to it's fullest extent, the pot is set to alter the speed of the chase patterns and the button changes the pattern (my favorite part).

My alterations to the program extended it from 4 program patterns to 7 and with my gained knowledge I have added a For Next timing loop that will change the patterns automatically without pressing the button.

The comments in the program are self explanatory.  However, there is  one thing I need to point out:

If you alter the number of Data program slots you must change the number in this line to reflect the number of pattern slots

LOOKUP patNum, [10, 20, 6, 6, 3, 5, 40], patLen 

The numbers correspond to patterns 1 - 7 accordingly.   Thus in the 'data bank', the first pattern has 10 slots, the next pattern has 20 slots, and so on and so on.   The last pattern is a huge 40 slot data bank that pretty much contains a sequence rather than a chase pattern.  The sequence would be great to flash the letters of a Theatre Marquee (R-I-A-L-T-O for example).

Well, enjoy the program.  Thanx again Jon, and I hope you don't mind me reverse engineering your program, but I had to learn someplace :).



' =========================================================================
'
'   File...... Pattern_Chaser_v6.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'   Revised by Jukin'Geo (added auto pattern change timing loop)
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Speed           PIN     15                      ' SETUP = DN, no ULN
PatSelect       PIN     14                      ' SETUP = DN
Leds            VAR     OUTH


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

IsOn            CON     1
IsOff           CON     0

Pressed         CON     1
NotPressed      CON     0

timeselect      CON     300                     'set time for pattern change


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

patNum          VAR     Nib                     ' pattern, 0 - 3
pntr            VAR     Word                    ' start of pattern
offset          VAR     Byte                    ' offset into pattern
patLen          VAR     Byte                    ' length of pattern
patbuf          VAR     Word                    ' pattern time buffer

delay           VAR     Word


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

Reset:
  DIRH  = %00111111                             ' make LEDs outputs


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

Main:

FOR patbuf = 1 TO timeselect                    ' auto pattern change
  IF (PatSelect = Pressed) THEN                 ' button pressed?
    Leds = %000000                              ' clear to indicate press
    patNum = patNum + 1 // 7                    ' point to next pattern
    offset = 0                                  ' reset to start
    DO WHILE (PatSelect = Pressed)              ' force release
    LOOP
  ENDIF

  LOOKUP patNum, [Pattern1, Pattern2, Pattern3, Pattern4, Pattern5, Pattern6, Pattern7], pntr
  LOOKUP patNum, [10, 20, 6, 6, 3, 5, 40], patLen

  READ pntr + offset, Leds                      ' update LEDs
  offset = offset + 1 // patLen                 ' adjust offset

Speed_Delay:
  HIGH Speed                                    ' charge RC circuit
  PAUSE 1
  RCTIME Speed, 1, delay                        ' read raw delay
  delay = delay / 3 + 50                        ' set new range
  PAUSE delay                                   ' hold a bit

NEXT

patNum = patNum + 1 // 7

GOTO main


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


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

Pattern1        DATA    %000001        'Cylon Eye
                DATA    %000010
                DATA    %000100
                DATA    %001000
                DATA    %010000
                DATA    %100000
                DATA    %010000
                DATA    %001000
                DATA    %000100
                DATA    %000010

Pattern2        DATA    %000001       'KITT - Knight Rider
                DATA    %000011
                DATA    %000111
                DATA    %001111
                DATA    %011111
                DATA    %111111
                DATA    %111110
                DATA    %111100
                DATA    %111000
                DATA    %110000
                DATA    %100000
                DATA    %110000
                DATA    %111000
                DATA    %111100
                DATA    %111110
                DATA    %111111
                DATA    %011111
                DATA    %001111
                DATA    %000111
                DATA    %000011

Pattern3        DATA    %000001       'Standard 6 Chan Chase
                DATA    %000010
                DATA    %000100
                DATA    %001000
                DATA    %010000
                DATA    %100000

Pattern4        DATA    %001110       '3-on 3-off Chase
                DATA    %011100
                DATA    %111000
                DATA    %110001
                DATA    %100011
                DATA    %000111

Pattern5        DATA    %100001       'In to center 3 Chan Chase
                DATA    %010010
                DATA    %001100

Pattern6        DATA    %001100       'Out from center 3 Chan Chase
                DATA    %011110
                DATA    %111111
                DATA    %110011
                DATA    %100001

Pattern7        DATA    %000001       '6 Letter Theatre Marquee
                DATA    %000011
                DATA    %000111
                DATA    %001111
                DATA    %011111
                DATA    %111111
                DATA    %111111
                DATA    %000001
                DATA    %000011
                DATA    %000111
                DATA    %001111
                DATA    %011111
                DATA    %111111
                DATA    %111111
                DATA    %000001
                DATA    %000011
                DATA    %000111
                DATA    %001111
                DATA    %011111
                DATA    %111111
                DATA    %111111
                DATA    %111111
                DATA    %000000
                DATA    %000000
                DATA    %111111
                DATA    %111111
                DATA    %111111
                DATA    %111111
                DATA    %000000
                DATA    %000000
                DATA    %111111
                DATA    %111111
                DATA    %111111
                DATA    %111111
                DATA    %111110
                DATA    %111100
                DATA    %110000
                DATA    %100000
                DATA    %000000
                DATA    %000000