November 23, 2024, 02:17:25 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.


Jack in the Box with Vmusic2 and RC4

Started by PerfessorEvil, October 30, 2009, 04:17:52 PM

Previous topic - Next topic

PerfessorEvil

Really thought I had plenty of time to code this, but didn't count on getting sick.  Help would be greatly appreciated because my brain isn't working right at the moment.

ULN leads are cut for pin 5, 6, and 7

I have an RC 4 at address %11, on pin 5. 
Plug 1 = crank
Plug 2 = strobe light

I have a Vmusic configured to your specs on pins p6 and p7, with four MP3s on them... call them 001.mp3, 002.mp3, etc.

I have a PIR on pin 4

I have a pnumatic on pin 1

What I'd like to do is:
When triggered, one of 3 mp3's randomly plays (preferably weighted towards sequence 1 and 2, but I can adjust that myself I think)

Sequence 1 (001.mp3):
Crank on
001.mp3 plays
When 001 stops, strobe on, pneumatic on, mp3 004 plays
After 20 seconds, pneumatic off, strobe off, crank off, reset

Sequence 2 (002.mp3)
Crank on
002.mp3 plays
when 002 stops, reset

Sequence 3 (003.mp3)
Crank on
003 plays
when 003 stops, pause 20 seconds, then strobe on, pneumatic on, mp3 4 plays
After 20 seconds, pneumatic off, strobe off, crank off, reset

Is this doable, or am I trying to do too much off of the prop-1?


JonnyMac

It seems doable, but barely.  Note that I am at a local haunt, borrowing their Internet access -- I was able to whip up this program and compile it (based on previous working code), but you're going to have to test it.

In order to minimize the number of GOSUBs I put the redundant stuff for each sequence outside the sequence handlers:
  - start the audio
  - start the crank
  - let audio finish

I used a trick with LOOKUP to weight the audio toward the first two files -- hopefully, it works.

Again, this compiles but is not tested -- leaving that part to you, my friend.  File is attached; I'm borrowing a Muc Mac for this reply and have no idea where to find a text editor.
Jon McPhalen
EFX-TEK Hollywood Office

PerfessorEvil

You are freaking amazing.  Seems to work perfectly, although I need to actually attach it to the prop to be 100% certain.  If nothing else, I can adjust from here.
Thank you, thank you, thank you.