November 24, 2024, 12:41:29 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.


Need some last minute help.

Started by Capt.Chaos, October 26, 2011, 08:07:08 PM

Previous topic - Next topic

Capt.Chaos

We have built a elevator for our event and need a little help. It is completely automated but we want to use a prop 1 to run the lighting. It is all lit by 12vdc LEDs. We are going to run the following lights 1=floor 3
2=floor 2
3=floor 1
4=basement
5=ceiling red lights
6=ceiling white lights
7=warning light

Here is the sequence
A. All ceiling lights on always(red and whites)
B. Prop triggered
C. 6 second delay
D. Floor 3light on for 3 seconds shuts off
E. Floor 2 light on for 3 seconds shuts off
F. Warning light starts to flash on and off and remains flashing for next 30 seconds then off
G.2 seconds after warning light starts flashing the ceiling red and whites start flashing in any intermittent pattern for next 28 seconds then off
H.2 seconds after ceiling lights start flashing  The floor indicator lights start cycling randomly through
different floors for next 20 seconds then stops on basement
I. Everything resets

So in a nutshell it is about a 45 second program that starts with a few floors then all chaos breaks loose for the remainder of the ride. Thanks for the help. A little past my current expertise.

Chaos
E.

1. Trigger activated
2. 8 second delay

JackMan

I'm sure Jon would do a much better job but I think this might be close to what you want. I haven't tested it but give it go.  ;)


'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Trigger         = PIN7                  ' SETUP = DN
                                                ' V+/OUT6 warning light
                                                ' V+/OUT5 white ceiling light
                                                ' V+/OUT4 red ceiling light
                                                ' V+/OUT3 basement
                                                ' V+/OUT2 floor 1
                                                ' V+/OUT1 floor 2
                                                ' V+/OUT0 floor 3


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

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


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


SYMBOL  idx             = B3
SYMBOL  leds            = B4
SYMBOL  counter         = B5
SYMBOL  timer           = W2
SYMBOL  delay           = W3
SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %01111111                              ' make P0-P6 outputs


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

Main:
  timer = 0                                     ' reset timer
  PIN4 = IsOn                                   ' red ceiling lights on
  PIN5 = IsOn                                   ' white ceiling lights on

Check_Trigger:
  RANDOM lottery
  PAUSE 5                                       ' scan delay
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  PAUSE 6000                                    ' pause 6 sec
  PIN0 = IsOn                                   ' floor 3 on
  PAUSE 3000                                    ' pause 3 sec
  PIN0 = IsOff                                  ' floor 3 off
  PIN1 = IsOn                                   ' floor 2 on
  PAUSE 3000                                    ' pause 3 sec
  PIN1 = IsOff                                  ' floor 2 off

  idx = 0

FOR counter = 1 TO 4                           ' flash warning light 2 sec
  TOGGLE 6
  PAUSE 500
NEXT

timer = 0

Chaos:
  RANDOM lottery                                ' big stir
  RANDOM lottery
  RANDOM lottery

  LOOKUP idx, (%0010000, %0100000, %1000000), leds ' flash warning and ceiling lights
  idx = idx + 1 // 3
  leds = lottery & %0001111 | leds              ' random floor lights
  PINS = leds
  delay = lottery // 251 + 100                  ' delay 100 to 350 ms
  PAUSE delay
  timer = timer + delay
  IF timer < 30000 THEN Chaos                   ' 30 sec

  PINS = %00001000                              ' basement on
  PAUSE 5000                                    ' pause 5 sec
  GOTO Reset

Capt.Chaos

Thanks Jackman! Unfortunately it did not work like I hoped. : P2 comes on then P3 comes on then 4 and 5 light up. Thats it. I really appreciate the help.

Chaos

Capt.Chaos

I take that back Jackman! I changed the trigger input and Bingo! Thanks much. I appreciate it.