November 23, 2024, 01:58:12 AM

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.


program request for Prop-1, RC-4, VMusic

Started by dbauer1080, October 23, 2008, 12:37:52 AM

Previous topic - Next topic

dbauer1080

Jon,

I am using EFX-Tek controllers exclusively in my haunted pole barn(Prop-2, 3-Prop-1's, 4 RC-4's, AP-8, FC-4, relays etc). The reason is, the products are truly outstanding and your support is unlike anything I've seen. (Now I sincerely apologize for asking for yet another program. Next year I'll have the programming at a higher level).

My haunted girl's room will use a Prop-1 to activate the VMusic for one file, RC-4 to activate lights and a wiper motor for a rocking chair. Prop-1 will activate 12 volt DC solenoid which will activate a 6" cylinder to bang lid of an aluminum toy chest repetitively.

As before, I may be able to adjust some timings with my Sonar SMPTE code.

Here's the timeline:

0:00    PIR activates Prop-1 to start VMusic file named girlroom.mp3
0:16    RC-4 starts wiper motor for rocking chair using K-1; also red light above girl starts using K-2
1:00    Green light above chest turned on by RC-4 K-3
1:20    Prop-1 starts solenoid in very short, quick jabs to bang lid - start few then more as time elapses until end(if this is possible)
1:57    End

Two minute delay until reactivation. Thank you so much for your patience and efforts.


JonnyMac

This one was a bit tricky.... in the banging section what I had to do was create a randomized set of bangs that followed by a progressively shorter hold-off delay.  By the end the hold-off is zero and the lid bangs like crazy.  Hopefully this gives you the effect you desire.

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


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


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


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

SYMBOL  RX              = 7                     ' SETUP = UP, no ULN
SYMBOL  TX              = 6                     ' SETUP = UP, no ULN
SYMBOL  Sio             = 5                     ' no ULN
SYMBOL  Trigger         = PIN4                  ' active-high input
SYMBOL  Lid             = PIN0                  ' use OUT0/V+


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

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

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  relays          = B0
SYMBOL   Rocker         =  BIT0                 ' on K1
SYMBOL   RedLight       =  BIT1                 ' on K2
SYMBOL   GrnLight       =  BIT2                 ' on K3

SYMBOL  idx             = B2

SYMBOL  holdOff         = W2
SYMBOL  delay           = W3
SYMBOL  timer           = W4
SYMBOL  lottery         = W5


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

Reset:
  SEROUT Sio, Baud, ("!!!!!RC4", %00, "X")
  relays = %0000

  PAUSE 2250                                    ' let VMUSIC power up
  GOSUB VM_Stop                                 ' stop if playing
  GOSUB VM_Wait_Prompt

  PINS = %00000000                              ' clear all
  DIRS = %00000001                              ' set outputs


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

Start_Audio:
  SEROUT TX, Baud, ("VPF girlroom.mp3", 13)
  GOSUB VM_Wait_Start
  PAUSE 16000

  Rocker = IsOn
  RedLight = IsOn
  GOSUB Set_RC4
  PAUSE 44000

  GrnLight = IsOn
  GOSUB Set_RC4
  PAUSE 20000

  timer = 37000                                 ' timer for lid activity
  holdOff = 5000                                ' delay between bangs

Bang_Lid:
  RANDOM lottery
  idx = lottery // 4 + 2                        ' 2 to 5 bangs

Bang_Again:
  Lid = IsOn
  PAUSE 100
  Lid = IsOff
  PAUSE 100
  IF timer < 200 THEN Program_Delay             ' abort if timer expired
    timer = timer - 200
  idx = idx - 1
  IF idx > 0 THEN Bang_Again

  IF holdOff < timer THEN Bang_Hold
    holdOff = timer

Bang_Hold:
  PAUSE holdOff
  timer = timer - holdOff
  holdOff = holdOff ** $CCCC                    ' x 0.8 (compress holdOff)
  IF timer > 0 THEN Bang_Lid

Program_Delay:
  Lid = IsOff                                   ' everything off
  relays = IsOff
  GOSUB Set_RC4
  FOR timer = 1 TO 120
    PAUSE 1000
  NEXT
  GOTO Main


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

VM_Stop:
  SEROUT TX, Baud, ("VST", 13)
  RETURN

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

VM_Wait_Prompt:
  SERIN RX, Baud, (">")
  RETURN

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

VM_Wait_Start :
  SERIN RX, Baud, ("T $")
  RETURN

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

Set_RC4:
  SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
  RETURN


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

livinlowe

That is a cool program Jon! Definetly learned something on this one. Cool application!
Shawn
Scaring someone with a prop you built -- priceless!

dbauer1080

Jon,

Many thanks, this looks like it took some doing and I appreciate it. Can't wait to give it a try tonight.

dbauer1080

Jon,

Got it hooked up - receive from Vmusic on P7, Transmit to Vmusic P6, Serial to RC-4 P5, PIR to P4. Cut pins from P5,6,7. Jumpers up on P6,7. Prop-1 power switch in 2 position.
Trying just with Vmusic, with PIR, , and somehow the Vmusic isn't being activated. The light on it just stays green. Any thoughts on what could be the issue?

dbauer1080

Jon,

My bad, please disregard last panic message. It was an easy fix(forgot I had loaded the Prop-2 9600 baud file instead of the 2400 Prop-1.

dbauer1080

Everything worked great, from the light changes to the rocking chair timing, and especially the lid banging. Got a lot of jumps from the kids. It is a phenomenal program. Thanks.