November 22, 2024, 08:54:21 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.


Maximum number of inputs on prop-1

Started by gadget-evilusions, August 19, 2007, 06:56:15 PM

Previous topic - Next topic

gadget-evilusions

I want to use four triggers to trigger a specific section of a program that will control the fc-4. Should I use a prop-2 or is it possible to use a prop-1. I know there is only two pins with set up jumpers, but was wondering.

Basically my program will go:

All outputs on fc-4 randomly flickering

trigger one causes the first channel of the fc-4 to go out until after trigger 4

trigger two causes the second channel of the fc-4 to go out until after trigger 4

trigger three causes the third channel of the fc-4 to go out until after trigger 4

trigger 4 causes the fourth channel to go off for 2 seconds to give the actor time to get into position, then all outputs back on to about 50% brightness for two seconds. Then will go back to all 4 channels of the fc-4 randomly flickering until trigger one is actiavted again.

Is this too much for a prop-1, I havent started programming yet. If I need to go prop-2 I wanted to know a head of time.

Thanks for any help.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Does the operation of the program always happen in this sequence? -- if it does, you can use one trigger and keep track of the program's state.  If you need four external triggers I'll show you a way to use three pins to get up to seven triggers (with two pins you can have three).  The trick is to use a bit of diode gating; pretty easy to do and will save you some $$$ over buying a Prop-2 (which we'll happily sell you if you really want one!)
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Yes, it always happens in this sequence. It's going to be a hallway where the customers are traveling down, and every time they hit a new trigger the light above them goes out, until they hit the last one which stays off, lets the actor get into position for their scare, and that's when the lights come back on. I need a trigger for each one because every group of victims travels at a different speed, and I want the lights to always coorespond with exactly where they are. If you can show me how to do the trggers that would be great.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Okay, here's one way to do it -- this uses "steering diodes" to route switch closures onto a buss that can be read as switch position.



And here's a program that matches your requirements using the button matrix as inputs. 

' =========================================================================
'
'   File...... Lamps.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 20 AUG 2007
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; use ULN2003


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0

SYMBOL  MinLevel        = 38                    ' ~15%


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

SYMBOL  mask            = B0                    ' lamp control bits
SYMBOL  mask1           = BIT0
SYMBOL  mask2           = BIT1
SYMBOL  mask3           = BIT2
SYMBOL  mask4           = BIT3

SYMBOL  trigger         = B1                    ' button inputs
SYMBOL  stage           = B2                    ' program stage

SYMBOL  lamp1           = B3                    ' lamp levels
SYMBOL  lamp2           = B4
SYMBOL  lamp3           = B5
SYMBOL  lamp4           = B6

SYMBOL  lottery         = W5                    ' random value
SYMBOL  lottoLo         = B10
SYMBOL  lottoHi         = B11


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

Reset:
  stage = 1                                     ' start at beginning
  mask = %1111                                  ' all lamps on


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

Main:
  GOSUB Update_Lamps                            ' flicker lamsp
  trigger = PINS & %00000111                    ' scan inputs
  IF trigger = %000 THEN Main                   ' wait for press

  IF trigger <> stage THEN Main
    LOOKUP stage, (%1111, %1110, %1100, %1000, %0000), mask
    stage = stage + 1
    IF stage < 4 THEN Main

Scare_Em:
  SEROUT Sio, OT2400, ("!FC4", %00, "X")      ' dark
  PAUSE 2000
  SEROUT Sio, OT2400, ("!FC4", %00, "P", $80) ' preset all to 50%
  PAUSE 2000
  GOTO Reset


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


Update_Lamps:
  RANDOM lottery                                ' randomize levels
  lamp1 = lottoLo MIN MinLevel
  lamp2 = lottoHi MIN MinLevel
  RANDOM lottery
  lamp3 = lottoLo MIN MinLevel
  lamp4 = lottoHi MIN MinLevel

  lamp1 = lamp1 * mask1                         ' update levels
  lamp2 = lamp2 * mask2
  lamp3 = lamp3 * mask3
  lamp4 = lamp4 * mask4

  SEROUT Sio, OT2400, ("!FC4", %00, "S", lamp1, lamp2, lamp3, lamp4)
  RETURN

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


' -----[ EEPROM Data ]-----------------------------------------------------


This program shows why I always reserve B0 and B1 -- some programs require bit variables and those are the only two bytes that allow access to their bits; I use this in the lamp updating subroutine to extinguish selected lamps.

Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Now, is it going to hurt anything having an input on a pin with no set up jumper?

And If I am reading and understanding this correctly, you could actually get even one more switch in there hypothetically? Not that I need too.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

August 20, 2007, 01:34:17 PM #5 Last Edit: August 20, 2007, 01:37:13 PM by JonnyMac
The "setup" jumpers are in the circuit -- notice those three resisters pulling P0, P1, and P2 to ground?....

You can actually get three more switches; with three bits you can have %000 (0) to %111 (7) -- zero, of course, means no switch is being pressed.  Note that the circuit cannot detect/prevent multiple button presses, so the code tries to defeat this by keeping track of the current program stage and comparing it with the input.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

That makes total sense now. Thank you very much. If I can't get this in a commercial attraction this year, it will at least be at my house on halloween, and then I will take video and post for all to check out.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

gadget-evilusions

is it possible to add a max brightness value to the  program you wrote above?
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Yes, see my response to your question in the FC-4 Flicking Lights thread (started by Liam).
Jon McPhalen
EFX-TEK Hollywood Office