Hi,
okay so this program works pretty good with one exception. This is what the program is designed to do. Before trigger the box sits there with only a snoring sound playing. When triggered the fog shoots off and sound changes to a growling, with the lid jumping up and down and the left and right lights flashing on and off for 5 seconds. Then the lid, base and lights all activate together for another 15 seconds. Then it goes back to "sleep" for 15 seconds. Like I said everything works great except the sound. Some times the second sound does not activate and the sleep sound continues. I have the CAP connected via the vtrig with the black lead on out5 and the white lead on v+ on the prop 1.
Any help would be appreciated. Below is the program.
' =========================================================================
'
' File...... MIB-V2.BS1
' Purpose...
' Author.... Tim Young
' E-mail....
' Started... 08-19-2010
' Updated... 08-22-2010
'
' {$STAMP BS1}
' {$PBASIC 1.0}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
' Program for a Monster in a Box. This prop has two pneumatic cylinders (one
' for the lid and one for the base). Also includes an RC-4 powering two lights
' and a fogger. Sound is via a CAP-275 player with two sounds one playing all the
' time and one when prop is triggered
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL Sio = 7 ' RC-4 SETUP = UP, no ULN
SYMBOL Trigger = PIN6 ' PIR SETUP = DN
SYMBOL CAPAudio = PIN5 ' Cowlacious CAP275 (OUT5)
SYMBOL Base = PIN1 ' Cyilinder for Lid
SYMBOL Lid = PIN0 ' Cyilinder for Base
' -----[ Constants ]-------------------------------------------------------
SYMBOL Baud = OT2400
SYMBOL IsOn = 1
SYMBOL IsOff = 0
SYMBOL ShakeTime1 = 5000 ' Lid shake time
SYMBOL ShakeTime2 = 15000 ' Base and Lid shake time
' -----[ Variables ]-------------------------------------------------------
SYMBOL relays = B0
SYMBOL LightL = BIT0
SYMBOL LightR = BIT1
SYMBOL Fogger = BIT2
SYMBOL K4 = BIT3
SYMBOL delay = B2
SYMBOL timer1 = W3 ' For ShakeTime1
SYMBOL timer2 = W4 ' For ShakeTime2
SYMBOL lottery = W5 ' For ShakeTime1
SYMBOL lottery2 = W6 ' For ShakeTime2
SYMBOL lotto1 = B10 ' For Lid
SYMBOL lotto2 = B11 ' For Base
SYMBOL lotto3 = B12 ' For Right light
SYMBOL lotto4 = B11 ' For Left light
' -----[ Initialization ]--------------------------------------------------
Reset:
PINS = %00000000 ' clear IOs
DIRS = %00100011 ' define output pins
SEROUT Sio, Baud, ("!RC4", %0000, "X") ' clear RC-4 outputs
PAUSE 15000 ' PIR warm-up, reset delay
' -----[ Program Code ]----------------------------------------------------
Main:
timer1 = 0
timer2 = 0
Check_Trigger:
RANDOM lottery ' stir random value
PAUSE 5 ' loop pad
timer1 = timer1 + 5 * Trigger ' update timer
IF timer1 < 100 THEN Check_Trigger ' wait for 0.1 sec input
timer1 = 0 ' restart timer for ShakeTime1
Fogger = IsOn
GOSUB Update_RC4
Start_Audio:
CAPAudio = IsOn
PAUSE 500 (revised)
CAPAudio = IsOff
Lid_Slam:
RANDOM lottery ' create new outputs
RANDOM lottery2
Lid = Lotto1
LightR = Lotto3
LightL = Lotto4
GOSUB Update_RC4
RANDOM lottery ' re-stir random
delay = lottery // 201 + 50 ' between 50 and 250 ms
PAUSE delay ' hold
timer1 = timer1 + delay ' update timer
IF timer1 < ShakeTime1 THEN Lid_Slam ' check run time
GOTO Base_Slam
Base_Slam:
RANDOM lottery ' create new outputs
RANDOM lottery2
Base = Lotto2
Lid = Lotto1
LightR = Lotto3
LightL = Lotto4
GOSUB Update_RC4
RANDOM lottery ' re-stir random
delay = lottery // 201 + 50 ' between 50 and 250 ms
PAUSE delay ' hold
timer2 = timer2 + delay ' update timer
IF timer2 < ShakeTime2 THEN Base_Slam ' check run time
GOTO Reset ' clear everything, delay
' -----[ Subroutines ]-----------------------------------------------------
Update_RC4:
SEROUT Sio, Baud, ("!RC4", %00, "S", relays)
RETURN
' -----[ User Data ]---------------------------------------------------
Here is a link to the video I took.
http://www.youtube.com/watch?v=4WvN-tBW7yI
Good work that you did, Youngti. The monster wants to come out of it's box, but he can't speak ;D.
Can you trigger the audio manually? If you can, then the pause instruction of 250 maybe too short. You can try this
PAUSE 1000
Jackman stated in a post in the Audio section under Cowlacious that he changed the pause instruction from 250 to 1000ms. He stated it works fine for him. I post this idea to someone else in the Audio section or can search the posts that I made.
The whole idea is to have healthy monster voice on Halloween ;D
I can't see anything wrong the start pulse to the CARP, but maybe that pulse needs to be longer when you're looping a background file.
Honestly, this may be a question better posed to Carl Cowley.
Thanks for the suggestions. Yeah, i was thinking of that too but to tired last night to try it. If it doesn't work i will talk with Carl. ;D
I can't say for sure, but maybe the PAUSE needs to match the length of your growling recording. At any rate, I think 250ms is the culprit. This is right from the manual:
Dual Message Mode (DM header)
Red shorting jumper is on the DM header and no shorting jumper is on the MM header.
This mode allows the unit to play the first message continually until the unit
receives a trigger. As soon as a trigger is received it skips to the next
message on the chip and plays it. When the trigger is over it goes back to
playing the first message on the chip. You can only have two messages
recorded on the chip for this mode to work properly.
Thank you all for the suggestions. That was it, I needed to set the pause (pulse) to 500 instead of 250.
Quote from: youngti on August 22, 2010, 09:53:53 PM
Here is a link to the video I took.
http://www.youtube.com/watch?v=4WvN-tBW7yI
Oh, wow! That is one cool MIB...especially with the lid opening wide and slamming down like that. What I would recommend since the lid opens so wide is to attach a couple of hairy arms with clawed hands/paws right under the forward part of the lid so it looks like a monster is really pushing up on the lid...THAT would be the icing on the cake!
Great job though, the box looks nice and old and that heavy chain is awesome.
Geo
I'm been thinking of that. The other thing I need to do is drape black plastic across the back to hide the pneumatics and switches. I had to replace the fake chain with real chain because the fake plastic chain was not holding up to the abuse.
Another great job with your MIB and don't forget to post it the Completed Projects.
William