November 15, 2024, 01:47:44 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.


Prop-1 Popup/matt switch/sound & lights...sorry I'm new

Started by deadhaunts, August 21, 2009, 10:53:25 AM

Previous topic - Next topic

deadhaunts

First of all I am very, very new to programming....

Just got my first Prop-1.  I was able to hook it up to a servo and make the servo move right to left.  Big accomplishment for me....
I looked all overt the postings and could not find out how to do the following....I was hoping to find someone that did something similar, then modify their program.

I have a prop that I made a few years ago that currently uses foot switch with a 14.5 power supply to power the solenoid that pops ups the prop.
Now I want to use the Prop-1 to:

1) turn on a light while the sound and pop up is on activated by the foot switch (I could replace the foot switch with a PIR sensor)
2) activate the pop up (stay up for a period of time)
3) Turn VMusic2 MP3 player for the sound (using this because you were out of the AP-8 and not sure when you are getting the AP-16)
4) reset



Thanks in advacne for any and all help.

Dave


JonnyMac

Fair warning: I'm not going to get caught up in anymore long-winded VMUSIC support threads; the product is junk and has cost me hours of time.  There are other choices (Rogue Robotics uMP3 is one of my favorites, or Cowlacious for ISD-based sound).

That said, and with the minimal details provided, I have written and tested the following program.  It works.  Please read the notes in the code very carefully and read the VMUSIC connections threads in our forums.

You will, of course, have to change the name of the MP3 file in the listing.  And do make sure that the files on your media are in 8.3 (DOS style) format -- one of the nightmarish support threads we suffered through had to do with the user putting files on the media with long file names (we didn't know that until he sent us this media stick).

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008-2009 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated... 21 AUG 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Prop code using the (crappy) VMUSIC2 player
' -- P7 and P6 SETUP jumpers need to be in the UP position
' -- clip pins 1, 2 and 3 from ULN2803, or pin 1 and 2 from the ULN2003
' -- use P5 for EFX-TEK serial accessories (RC-4, etc.)
' -- use P4 for (active-high) trigger (PIR, mat switch, etc.)
'
' After downloading the program cycle power on the Prop-1 to allow the
' Prop-1 and VMUSIC to sync up.


' -----[ 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                  ' MUST HAVE ULN

SYMBOL  PopUp           = PIN1                  ' use V+/OUT1
SYMBOL  Light           = PIN0                  ' use V+/OUT0


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

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

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' preset IOs (all off)
  DIRS = %00000011                              ' define outs (1s)

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


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

Main:
  timer = 0                                     ' reset timer

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

  ' MP3 file name must be 8.3 format
  ' -- old DOS style

  SEROUT TX, Baud, ("VPF fruity.mp3", 13)       ' start audio
  GOSUB VM_Wait_Start

  Light = IsOn
  PopUp = IsUp

  GOSUB VM_Wait_Prompt                          ' let audio finish

  Light = IsOff
  PopUp = IsDown

  PAUSE 20000                                   ' retrigger delay
  GOTO Main


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

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

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

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

  ' falls through to VM_Wait_Prompt
  ' -- ensures VM ready for command after we stop it

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

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


' -----[ User Data ]-------------------------------------------------------




Jon McPhalen
EFX-TEK Hollywood Office

deadhaunts

Thanks.  I should have read all of the threads before i got the VMusic.   I'll look into the Cowlacious and the Rouge Robotis.  Any update on your AP-16?

JonnyMac

We will announce the AP-16 when it's ready for sale.

Please do not change thread topics mid-stream as this is a violation of our forum guidelines.  I am locking this thread for the violation.
Jon McPhalen
EFX-TEK Hollywood Office