November 22, 2024, 10:07:41 PM

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.


Will the Prop-1 do this?

Started by Jeff Haas, September 18, 2008, 01:54:36 AM

Previous topic - Next topic

Jeff Haas

Jonny,

I've worked out the electronics issues with the sound board for my prop, and I've figured out how I want the LEDs to act.  I've included the behavior below.  Question: Will the Prop-1 do this?  Or do I need to go to one of the other boards?  I'm asking before I buy, so I get the right thing.

Jeff

=======

Teleport 2000 v.2
Requirements, buttons, modes

1. Power switch - SPST switch
2. "Activate" switch - momentary contact switch
3. Mode switch - SPST switch.
4. Pot - Dual-gang 5k, one controls the EFX board, the other controls the sound board
5. LEDs along the top of the prop, pointed at the audience, arranged in this pattern:

1 2 3 4 5 6 7 8 9 0

The following "modes" are named for the performing effect, not what the software and/or hardware is actually doing.

-----------

Idle mode:

- Power switch is turned on.
- Activate switch is open.
- Mode switch is open.
- LEDs randomly blink at a slow rate.  Think of the lights under
the original Star Trek viewscreen.


-----------

Tuning mode:

- Activate switch is closed.
- Pot is adjusted.  (This will vary the sound effect from the sound board.)
- Mode switch remains open.
- LEDs scan (Knight Rider effect) at a slow rate.

In performance, after this mode, Activate switch is released and Pot is adjusted back to starting position.
LEDs go back to Idle blinking pattern.

-----------

Teleport mode:

- Pot has been adjusted back to starting position.
- Mode switch is closed.  (This changes the sound effect produced by the sound board.  Probably will have two mode switches, one for the EFX board and one for the sound board.)
- Activate switch is closed.
- LEDs scan at a slow rate.

Then...

- Pot is adjusted.  LEDs do the Knight Rider effect  As Pot is adjusted, LEDs start scanning faster.   After Pot has been turned to over a specific value (TBD), LEDs change pattern from left/right "Knight Rider" pattern and go from ends to the center.  i.e.:

1 2 3 4 5 6 7 8 9 0

LEDs 1 and 0 light up, then 2 and 9 light up, then 3 and 8 light up, then 4 and 7
light up, finally 5 and 6 light up.  Then pattern is repeated.

JonnyMac

You do not have enough pins on the Prop-1 for that; and probably not enough program space, either.  The Prop-2 has enough of both. 

Here's a rough draft of what I think will do it.  If you buy product then I'll hook-up parts to my Prop-2 and help you fine-tune the timing elements.

' =========================================================================
'
'   File...... Teleport_2000.BS2
'   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... 18 SEP 2008
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

PotIn           PIN     15                      ' SETUP = out, no ULN
Activate        PIN     14                      ' SETUP = DN
Mode            PIN     13                      ' SETUP = DN


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

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


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

lottery         VAR     Word                    ' random value
potVal          VAR     Word                    ' current pot value
ledTimer        VAR     Word                    ' for LED pattern timing
ledSpeed        VAR     Word

idx             VAR     Byte                    ' loop controller
state           VAR     Byte                    ' program state, 0 - 2
actTimer        VAR     Byte                    ' debounce timer
pntr            VAR     Byte                    ' table pointer


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

Reset:
  OUTS = $0000                                  ' clear outputs
  DIRS = $03FF                                  ' make P0-P9 outputs


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

Main:
  FOR idx = 1 TO 3                              ' stir random #
    RANDOM lottery
  NEXT
  PAUSE 8                                       ' tune for ~10ms loop
  ledTimer = ledTimer + 10                      ' update LED timer

Read_Pot:
  HIGH PotIn                                    ' charge cap
  PAUSE 1
  RCTIME PotIn, 1, potVal                       ' read RC

Back_To_Zero:
  IF Activate = IsOff THEN                      ' check for release
    state = 0
    actTimer = 0
    GOTO Main
  ENDIF

  BRANCH state, [Idle, Tuning, Teleport]
  state = 0


Idle:
  actTimer = actTimer + 10 * Activate           ' debounce Activate
  IF actTimer >= 100 THEN                       ' valid press
    state = 1 + Mode                            ' set new state
    actTimer = 0                                ' clear activate timer
    pntr = 0                                    ' reset data pointer
    GOTO Main                                   ' handle new state now
  ENDIF
  IF ledTimer >= 1500 THEN                      ' 1.5 secs per change
    OUTS = lottery & $03FF                      ' randomize outputs
    ledTimer = 0                                ' restart the timer
  ENDIF
  GOTO Main


Tuning:
  IF ledTimer >= 250 THEN                       ' 0.25 secs per change
    READ Scanner + (pntr * 2), OUTS             ' new pattern
    pntr = pntr + 1 // 18                       ' update pointer, 0-17
    ledTimer = 0                                ' restart the timer
  ENDIF
  GOTO Main


Teleport:
  IF potVal < 300 THEN
    idx = potVal / 60
    LOOKUP idx, [250, 200, 150, 100, 50, 25], ledSpeed
    IF ledTimer >= ledSpeed THEN
      READ Scanner + (pntr * 2), OUTS
      pntr = pntr + 1 // 18
      ledTimer = 0
    ENDIF
  ELSE
    IF ledTimer >= 150 THEN                     ' 0.15 secs per change
      READ Center + (pntr * 2), OUTS            ' new pattern
      pntr = pntr + 1 // 5                      ' update pointer, 0-17
      ledTimer = 0                              ' restart the timer
    ENDIF
  ENDIF
  GOTO Main


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


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


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

Scanner         DATA    Word %0000000001        ' pntr = 0
                DATA    Word %0000000010        ' pntr = 1
                DATA    Word %0000000100
                DATA    Word %0000001000
                DATA    Word %0000010000
                DATA    Word %0000100000
                DATA    Word %0001000000
                DATA    Word %0010000000
                DATA    Word %0100000000
                DATA    Word %1000000010
                DATA    Word %0100000000
                DATA    Word %0010000000
                DATA    Word %0001000000
                DATA    Word %0000100000
                DATA    Word %0000010000
                DATA    Word %0000001000
                DATA    Word %0000000100
                DATA    Word %0000000010        ' pntr = 17


Center          DATA    Word %1000000001        ' pntr = 0
                DATA    Word %0100000010
                DATA    Word %0010000100
                DATA    Word %0001001000
                DATA    Word %0000110000        ' pntr = 4
Jon McPhalen
EFX-TEK Hollywood Office

Jeff Haas

Thanks!  I didn't expect you to turn out the code yet.

If I could live with eight LEDs instead of ten, would that work with the Prop-1?  Or should I still go with the Prop-2?

This is mostly a space issue in the eventual hand-held prop.

Also, I think I forgot to mention, this needs to be run completely from batteries, I'll use whatever will work (a set of AA cells, etc.)

Jeff

JonnyMac

At the risk of stating the obvious the Prop-1 has eight IO points and your program needs three inputs (Activate, Mode, Pot) -- this would leave you with five LEDs.  Even if five LEDs was enough, what you want from the code will not fit in the Prop-1.  Trust me on that.
Jon McPhalen
EFX-TEK Hollywood Office

Jeff Haas

Understood.  Thanks.  I'll order the Prop-2 then.

Jeff Haas

Got the Prop-2 today, and have gone through the tutorials with the trainer board.  The Prop-1 Trainer is a great tool!  I've already played with variables to see how to control the timing of the various demo programs.

I'll be out of town for a couple of days but will be ready to work with it Monday.

Should we move discussion of this project to the Prop-2 forum?

JonnyMac

Yes, and thank you for helping us keep our forums organized.  Go ahead and start a new thread that discusses what your program needs.
Jon McPhalen
EFX-TEK Hollywood Office