November 24, 2024, 02:57:04 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.


Casa De Zombie

Started by cs1245, October 26, 2012, 12:26:41 AM

Previous topic - Next topic

cs1245

I am running a Prop-1 and AP16 for the Casa De Zombie program.  Using serial input from the Prop-1 P7 I trigger the AP16.  I have AMBIENT track and SFX00, SFX01, and SFX02 with the yellow hex dial pointing to 3 and the AP16 option switch is moved "up"for ? and the loop sign switch is moved "up".  The PIR is attached to the P6 and I have ULN 2803 with the most upper left pin clipped for the serial communication with AP16. 

Here is the program I am using. 
Here are the issues I have been experiencing.
I turn on the AP16 and the Prop-1 and I hear the AMBIENT track, but only for 15 secs and then AMBIENT sound shuts off.  Then the Prop-1 will spontaneously trig the AP16 ( and the it trigs the pneumatics and eyes just fine) to randomly play one of the SFX tracks (which is what I expect), once the SFX track is done the AMBIENT restarts (but only plays for 15 secs) and then the Prop-1 keeps retriggering about every 15 secs - playing the SFX and then the AMBIENT - you get the picture.   FYI,  I have tried several different the PIR and still no change.

Any thoughts? 
=========================================================================
'
'   File...... Evilusions_GroundBreaker.BS1
'   Purpose...
'   Author....
'   E-mail....
'   Started... 4-1-10
'   Modified.. 06 JUL 2012 (JonnyMac)
'
'   {$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  Eyes            = 2                     ' V+/OUT2
SYMBOL  Shoulder2       = PIN1                  ' V+/OUT1
SYMBOL  Shoulder1       = PIN0                  ' V+/OUT0


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0                     ' put back to low/off

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' baud serial

SYMBOL  ThrashTime      = 15000


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

SYMBOL  idx             = B2
SYMBOL  valves          = B3
SYMBOL  last            = B4

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


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

Reset:
  PINS = %00000000                              ' preset IO pins
  DIRS = %00000111                              ' define IO pins

  PAUSE 10000                                   ' 10s inter-show delay


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery                                ' randomize lottery value
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' inc or clear timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

Start_Audio:
  SEROUT Sio, Baud, ("!AP16", %00, "P?", 2, 1)

Its_Alive:
  HIGH Eyes                                     ' Eyes flash on
  PAUSE 100
  PINS = PINS | %00000011                       ' both shoulders on
  PAUSE 1000

Thrasher:
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT
  valves = lottery & %00000011                  ' isolate valve channels

  IF valves = last THEN Thrasher                ' no repeats
    last = valves                               ' save for next cycle

  PINS = PINS & %11111100                       ' clear old valve settings
  PINS = PINS | valves                          ' update shoulders
  RANDOM lottery                                ' restir
  delay = lottery // 251 + 100                  ' delay 100 to 350 ms
  PAUSE delay
  timer = timer + delay                         ' update timer
  IF timer < ThrashTime THEN Thrasher           ' thrash for 10 seconds

  PINS = PINS &/ %00000011                      ' shoulders off

  FOR idx = 255 TO 0 STEP -1                    ' slow death fade out
    PWM Eyes, idx, 2
  NEXT

  GOTO Reset

JonnyMac

Do not test with PIRs -- use a normally-open switch to test.  It's impossible to be near your prop/PIR and have it work normally.

You may have a crappy SD card which is why the ambient file is stopping after 15 seconds -- we've seen that a few times this year.  Make sure that it is speed rated for at least Class 4.

I've looked over that program and there are no problems with it.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

I am going to add to Jon's point here.
QuoteDo not test with PIRs -- use a normally-open switch to test.  It's impossible to be near your prop/PIR and have it work normally.
What Jon's stating is remove the PIR and take normally open switch or normally open pushbutton and connect between P6.W and P6.R (in you case and base on the code posted). This can be easily done with a extender cable (servo cable) by cutting one of the plug ends off of one end and solder your button or switch to the red and white wire. Do not connect anything to the black wire.  Once you are happy with your testing then you can reconnect the PIR back where you had it.
William Stefan
The Basic Stamp Nut

JackMan

October 26, 2012, 05:36:44 AM #3 Last Edit: October 26, 2012, 05:56:11 AM by JackMan
One problem I see with that code is the 10 second inter-show delay in RESET. This isn't enough time for the PIR to properly warm up and calibrate. It needs at least 30 seconds, 60 is best. You can change the PAUSE to fix this, if you don't want that long of a post delay then just add a Power_Up: section above RESET with a 60 second PAUSE. As Jon stated, test your program without the PIR to see if there are any issues. I loaded this program and tested it with a N.O. push button as the trigger and it works fine.

cs1245

I reloaded the AMBIENT.WAV file and now it works.  I dont think it makes a difference, but the AMBIENT sound track was 20 secs in length initially and now I extended it to a full 2 min and that is the only thing I changed and now it runs great. 

JackMan

Well, I'm glad it's working for you although that still doesn't account for why your Prop-1 was triggering every 15 seconds.