November 24, 2024, 11:28:04 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Program needed with prop1 controller and AP-16 audio player

Started by joecuellar3, October 03, 2012, 11:20:08 AM

Previous topic - Next topic

joecuellar3

Hello,
I'm in need of help to program the prop1 controller with the AP-16+ audio player.
Here is the equipment.
Three 110v light with the Crydom solid state relay.
One Precision Z - High Power Floodlight from dark light
One Precision Alpha - Micro Theatrical Pinspot from dark light
One audio track 0000.wav
One audio track 0001.wav
Here is the scenario.
Program starts
Audio track 0000.wav begins to play and the three 110v lights begin to randomly flicker for 5 seconds
After 5 seconds the lights goes out, but the track still plays
A 2 second dwell occurs
Then the Precision Z turns on,  Precision Alpha comes on, the audio track 0000.wav stops, and the track 0001.wav begins to play
The Precision Z, Precision Alpha, and track 0001.wav go for 10 seconds
A dwell of 20 second goes
And then reset back to the top of the program
I hope this is enough information.

JonnyMac

A couple things:

1) Your audio tracks must be named SFX00.WAV and SFX01.WAV.

2) I don't understand your timeline. Let me try to spell it out here for you to correct if I have something wrong


T0:00 (trigger detected)
-- start SFX00.WAV on AP-16+
-- flicker AC outputs for 5 seconds

T0:05
-- stop flicker of AC outputs

T0:07
-- start SFX01.WAV on AP-16+ (auto kills SFX00.WAV)
-- DC lights on

T0:17
-- DC lights off
-- kill SFX01.WAV? (or does it just run out?)

T0:37
-- back to top (wait on next trigger)



As you can see, I've spelled out the timing between events. Did I get it right? Please make any adjustments and we'll whip up a program for you.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

I have to leave the office early today so here's a program that matches my interpretation of your request.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  FloodLight      = PIN4
SYMBOL  PinSpot         = PIN3

SYMBOL  ACLamp3         = PIN2
SYMBOL  ACLamp2         = PIN1
SYMBOL  ACLamp1         = PIN0


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  delay           = B2                    ' for flicker

SYMBOL  timer           = W4                    ' for debounce loop
SYMBOL  lottery         = W5                    ' random #


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

Power_Up:
  PAUSE 3000                                    ' let AP-16+ power up

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs

  PAUSE 20000                                   ' 20s delay


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

T0_00:
  SEROUT Sio, Baud, ("!AP16", %00, "PS", 0, 1)  ' start SFX00.WAV (play 1x)
  timer = 5000                                  ' set flicker timer

Flicker:
  RANDOM lottery                                ' big re-stir
  RANDOM lottery
  RANDOM lottery
  PINS = lottery & %00000111                    ' randomize AC pins
  delay = lottery // 76 + 25                    ' 25 to 100ms
  IF delay > timer THEN Flicker_End             ' almost done
    PAUSE delay                                 '  no, run delay
    timer = timer - delay                       '  update timer
    IF timer = 0 THEN T0_05                     '  check for expiration
      GOTO Flicker                              '   keep flickering

Flicker_End:
  delay = delay - timer                         ' fix delay for 5s
  PAUSE delay

T0_05:
  PINS = %00000000                              ' clear flicker outs
  PAUSE 2000                                    ' 2s idle

T0_07:
  SEROUT Sio, Baud, ("!AP16", %00, "PS", 1, 1)  ' start SFX01.WAV (play 1x)
  PINS = %00011000                              ' DC lamps on
  PAUSE 10000                                   ' 10s hold

T0_17:
  GOTO Reset                                    ' clear all, do 20s delay


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


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


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