May 20, 2024, 09:07:30 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.


Monster in the Box

Started by youngti, October 28, 2015, 01:54:59 PM

Previous topic - Next topic

youngti

I was now with two different SD cards I am not.  The status light does not light at all.

JackMan

October 28, 2015, 06:20:12 PM #16 Last Edit: October 28, 2015, 10:04:54 PM by JackMan
Considering all the info you have provided, I have to think there's possibly something wrong with that AP-16 but please check with Jon.

youngti

Okay well that is not good.  Since its brand new.

What about the code?  You said there was some issues with that.

How do I go about getting one by Friday?

JackMan

I'll try to get it straightened out later tonight unless someone else gets to it first.

youngti

Thank you for your help.  I have sent a PM to Jonny and see what he says about the replacement.

JackMan

October 28, 2015, 09:07:32 PM #20 Last Edit: October 28, 2015, 09:12:01 PM by JackMan
Give this a try. Although I did correct a few things, I'm not sure about the LightFlash section. The part where LightR = lottoLo and LightL = lottoHi.  I left that part as you had it but I don't think it's correct, not really sure what to do there. Anyway, see where this gets you.


'   File...... Monster-in-a-Box_V3.BS1
'   Purpose...
'   Author.... Tim Young
'   E-mail....
'   Started... 08-14-09
'   Updated... 10-28-2015
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP, no ULN RC4
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Base            = PIN1                  ' BaseCylinder
SYMBOL  Lid             = PIN0                  ' LidCyilinder

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

SYMBOL  Baud            = OT2400

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0

SYMBOL  FogRun          = 2000                  'Fog on for 2 seconds

SYMBOL  MinJump         =   100                 ' timing for lid/box jumps
SYMBOL  MaxJump         =   250
SYMBOL  JumpTime        = 10000
SYMBOL  LightTime       = 30000

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

SYMBOL  relays          = B0
SYMBOL   LightR         =  BIT0
SYMBOL   LightL         =  BIT1
SYMBOL   Fogger         =  BIT2
SYMBOL   K4             =  BIT3

SYMBOL  timer           = W3                    ' event timer
SYMBOL  delay           = W4                    ' run delay
SYMBOL  lottery         = W5                    ' random #
SYMBOL   lottoLo        =  B10
SYMBOL   lottoHi        =  B11

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

Reset:
  PINS = %00000000                              ' clear IOs
  DIRS = %00000011                              ' define output pins

  SEROUT Sio, Baud, ("!RC4", %00, "X")          ' clear RC-4 outputs
  PAUSE 30000

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

Main:
  timer = 0

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

SEROUT Sio, Baud, ("!AP16", %01, "PS", 1, 1)  ' play SFX01

Start_Fog:
  Fogger = IsOn
  GOSUB Update_RC4
  PAUSE FogRun
  Fogger = IsOff
  GOSUB Update_RC4
  timer = 0
Lidactive:
  RANDOM lottery                                ' re-stir
  delay = MaxJump - MinJump + 1                 ' get span
  delay = lottery // delay + MinJump            ' calc jump timing
  Lid = IsOn - Lid                              ' toggle cylinder

LightFlash:
  RANDOM lottery                                ' create new outputs
  LightR = LottoLo
  LightL = LottoHi
  RANDOM lottery                                ' re-stir random
  delay = lottery // 201 + 50                   ' between 50 and 250 ms
  PAUSE delay                                   ' hold
  timer = timer + delay                         ' update timer
  IF timer < LightTime THEN Lidactive           ' check run time
  GOSUB Update_RC4
  timer = 0

Baseactive:
  RANDOM lottery                                ' re-stir
  delay = MaxJump - MinJump + 1                 ' get span
  delay = lottery // delay + MinJump            ' calc jump timing
  Base = IsOn - Base                              ' toggle cylinder

  PAUSE delay                                   ' hold
  timer = timer + delay                         ' update run timer
  IF timer < JumpTime THEN Baseactive           ' if not done, go again
  GOTO Reset

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

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

youngti

Thank you for your response.  Just so you know the original code ( here http://www.efx-tek.com/php/smf/index.php?topic=1484.msg8582#msg8582) worked perfectly with the scary terry audio board.  What would happen is the box would be triggered, the lid would open and close randomly, then both the lid and the box would jump up and down ( like the monster was not only trying to get the lid open but overturn the box too.  As well as the two lights (red) inside the box would flash randomly not together.  Also the fog machine would shoot off for about 2 seconds.

Thank you for the code, it is now triggering, but the lid goes then stops, then the forward movement of the box goes.  The lights do not flash. But the fog does shoot off.  Can you take a look at my above post and see what I did originally.  Honestly it was working fine before I started mucking about (except the sound quit).

JonnyMac

I'm very late to this discussion -- was helping a local prop shop with HC-8+ programming.

For the record... our sales page details the return process; sending me (in CA with no inventory) a PM is not an option that will help you. Contacting the sales office is required.

Since you still have the AP-16+ in your possession, please download the firmware file from our web site, put it onto a freshly-formatted SD card, and then power up the AP-16+. If it's working, it should reprogram itself. Now we know you have the latest code and that the device is at least doing something.

Make sure ALL of the configuration switches are off. Put SFX00.WAV and SFX01.WAV onto the device and try them manually. If those work, put AMBIENT.WAV onto the card and then activate the looping switch. Make sure the random (?) switch is off. If you have it on with the SELECT in position 0 it can make the device act like it's hung up (I'm changing this in code for a future version, but it is nonsensical to select randomization of one file).

Do not make assumptions about your files. If I had a dollar for every time I was told "My WAV files are fine" I'd be a rich man. Open them in Audacity, select Edit Metadata from the File menu, then press the Clear button on the metadata dialog. Set the sample rate to 32kHz and if the file can be mono, make it mono. These last two steps reduce the file size without sacrificing quality and help slow SD cards provide the data quickly enough to play. Make sure that you save the files with the correct names. In Audacity you only need to put the name (e.g., SFX00), it will add the extension. Another trap people fall into is creating names with double extensions like SFX00.WAV.WAV -- this is why I tell Windows to show me file extensions for known types.

If none of this works, call JB at the sales number in the morning. I cannot guarantee he can overnight a new board.

Jon McPhalen
EFX-TEK Hollywood Office

youngti

Thank you for the response.  I did download the firmware from site.  Formatted A SD card and extracted firmware to SD card.  Put it in the AP16 with nothing connected and all configuration switches off.  Noting happened, no status lights.

JackMan

October 29, 2015, 06:17:19 AM #24 Last Edit: October 29, 2015, 06:18:59 AM by JackMan
OK, I took that original code that you provided in post #21. The only change I made was to remove PIN5 from the I/O's and change the audio play to accommodate the AP-16+ SFX01 file. Everything else is the same so if it worked before it should work now. Just an FYI, this code is quite a bit different than the one you posted at the very beginning of this thread so not sure how or why you changed so much of it.


' =========================================================================
'
'   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.

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

' 10/29/15 - Removed CAP audio player and added AP-16+

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

SYMBOL  Sio             = 7                     ' RC-4 SETUP = UP, no ULN
SYMBOL  Trigger         = PIN6                  ' PIR SETUP = DN
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 = %0000011                              ' 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:
  SEROUT Sio, Baud, ("!AP16", %01, "PS", 1, 1)  ' play SFX01

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



JackMan

One last observation, I think your CAP audio board took a dirt nap due to the amount of fog in that box, not the shaking.
That amount of repeated fog in an enclosed space is not good for any exposed electronics.  ;)

youngti

D'oh I have to get more sleep.  That code I posted was an original one and the one on the forum was the correct one.  Thank you for pointing out what should have been obvious to me.

As to the CAP I agree, another reason to get everything out of the box and on a control board.  Thank you it is working like it was supposed.

Thank you so much.

youngti

One other think I MUST say.  I have worked with the EFX-TEK guys for years, since my first major project the talking 3axis grim reaper (http://www.efx-tek.com/php/smf/index.php?topic=804.msg4450#msg4450)  which is still working away these many seasons.

After talking to JonnyMac the new AP16 has an intermittent fault.  They, at their expense, are sending me next day a replacement.  This, among many other reasons (their customer support, willingness to help, answering stupid questions), is why I stay with them.  Since 2008 they have done more to help me increase my Haunt and increase my neighborhoods enjoyment of Halloween.  They are Stellar and above the other manufacturers.  I constantly tell all my friends and the Instuctables crowd about them and their products.

THANK YOU, THANK YOU, THANK YOU!!!!!!