November 22, 2024, 08:18:07 PM

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.


flashing lights

Started by gatesofterror, July 04, 2007, 04:58:27 PM

Previous topic - Next topic

gatesofterror

John, This is Jim Walls, I spoke with you on the phone earlier.
I am using the Prop 1 controller and AP-8 sound board.
I need as many 12 volt lights as possible to flash on and off in sequence around the room, on only for about 1/4 of a second each. At the end of the light sequence I need to turn on a strobe light and activate the sound card. An actor will turn on a switch to start the program and turn the switch off to stop the strobe and sound. Then turn the switch on to start over for the next group.

JonnyMac

Here you go, Jim; this should get you going.

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


' -----[ Program Description ]---------------------------------------------
'
' Setup:
'
' -- replace the ULN2803A with a ULN2003A; this frees pin 7 for serial i/o
'    (see Prop-1 Trainer documentation for instructions)
'
' -- P7 SETUP = out
'
' -- connect P7 to AP-8 serial header -- be mindful of WRB cable polarity
'
' -- remove AP-8 baud and address jumpers (set for 2400 baud, addr = %00)
'
' -- connect normally-open switch between P6.W and P6.R
'
' -- P6 SETUP = DN


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6
SYMBOL  Strobe          = PIN5
SYMBOL  Light5          = PIN4
SYMBOL  Light4          = PIN3
SYMBOL  Light3          = PIN2
SYMBOL  Light2          = PIN1
SYMBOL  Light1          = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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

SYMBOL  ap8Status       = B0
SYMBOL  playing         = BIT7


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

Reset:
  PINS = %00000000
  DIRS = %00111111

  SEROUT Sio, OT2400, ("!!!!!!!AP8", %00, "X")  ' stop AP-8


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

Main:
  IF Trigger = IsOff THEN Main                  ' wait for trigger

Sequence:
  Light1 = IsOn
  PAUSE 250
  Light1 = IsOff

  Light2 = IsOn
  PAUSE 250
  Light2 = IsOff

  Light3 = IsOn
  PAUSE 250
  Light3 = IsOff

  Light4 = IsOn
  PAUSE 250
  Light4 = IsOff

  Light5 = IsOn
  PAUSE 250
  Light5 = IsOff

  Strobe = IsOn

Start_Audio:
  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)     ' start audio

Check_Exit:
  IF Trigger = IsOff THEN Reset                 ' time to quit?
  PAUSE 50                                      ' no
  SEROUT Sio, OT2400, ("!AP8", %00, "G")        ' check audio
  SERIN  Sio, OT2400, ap8Status
  IF playing = IsOff THEN Start_Audio           ' restart if done
    GOTO Check_Exit

  GOTO Reset


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


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


' -----[ EEPROM Data ]-----------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

gatesofterror

At MHC I purchased the RC-4 to use with this program. What modifications do I need to do to the program to get the prop 1 controller with this program to talk to the RC-4. I tried just hooking it up but nothing happens.

JonnyMac

That depends on how you hook it up; if you use direct connections it will work.  That means connecting P0-P3 headers to the X1-X4 headers on the RC-4.  That's a lot of wires, though, and you can in fact use the P7 connection to send messages.  Here's the rub: that program has five light outputs and one strobe output; which outputs are going to be mapped to the RC-4?
Jon McPhalen
EFX-TEK Hollywood Office

gatesofterror

I plugged in on P7 to the RC-4. and the switch to P6. I can turn the strobe on manually, if I can get the controller to turn the lights on and off.

gatesofterror

I used jumpers from P1 to X1, P2 to X2, P3 to X3, P4 to X4 and using P6 as the switch. K1 and K2 light up when activated but K3 and K4 do not light up.

JonnyMac

Best to check cables; if that still doesn't work you can troubleshoot using the [known good] P1 output to test each of the Kx manual inputs.  It would be better, IMHO, to use a serial connection, and if you want to do that I'll update the code so that works that way.  Just tell me which outputs to map to the RC-4.
Jon McPhalen
EFX-TEK Hollywood Office

gatesofterror

I got all 4 working. I will get with you later on setting it up complete with strobe. I need to get another RC-4 first.
Thank you