November 22, 2024, 07:05:12 AM

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.


My Mourner prop for 2008

Started by LPFreak1283, April 07, 2008, 12:21:02 PM

Previous topic - Next topic

JonnyMac

I added a flag (skipScare) to the listing above.
Jon McPhalen
EFX-TEK Hollywood Office

LPFreak1283

Jon, the skipScare is not working.  I added debug's into the code to show where it was going and it goes into the infinite loop without question.  any guess on why?

JonnyMac

Whoops... the bit has to be set before jumping to Cry -- I fixed the listing.
Jon McPhalen
EFX-TEK Hollywood Office

LPFreak1283

Everything is working great now!  Thanks so much for all your help on this!  Now to get to the building phase! 

Are you going to be at the Midwest Haunters Convention?  I'm driving 5 hours from Buffalo to be there!  I'll definitely stop by and kiss your feet!   :D

JonnyMac

We will be at MHC (one of our favorite shows) -- but no feet kissing, please; just buy me a beer. Guinness is my favorite.   ;D
Jon McPhalen
EFX-TEK Hollywood Office

LPFreak1283

Hey Jon!
It's been a while since I've been on to update my prop status. Well, she is coming along great!  I don't have a recent pic of her for some reason to show you, but I will soon enough!  Plus I intend on getting some sort of video.

Anyways, I just got a quick question.  When I plug the main plug of the electronics system into the outlet, the servo updates a little bit, which is normal, but the RC-4 doesn't respond right way.  The board shows that it is off (by way of the LEDs) and of course the spot light isn't on.  But when I press the reset button on the prop-2, everything is on and wonderful.  Plus it runs that way for hours.  Is there any way to avoid having to struggle to get into the casket holder to press the reset button?  Or should I just deal with it cause the prop kicks @$$?

I have wondered if I can extend the reset button with some wire so I can put a new button somewhere more convenient.  But I don't really want to do that and ruin the prop-2. 

Any thoughts?

Thanks
Cory

JonnyMac

Power up and pressing the reset button should give about the same results.  That said, I can't really tell without seeing your code -- post it and I'll figure it out.
Jon McPhalen
EFX-TEK Hollywood Office

LPFreak1283

' =========================================================================
'
'   File....... Mourner.BS2
'   Purpose.... Halloween 2008 Project
'   Author..... FrontYardHaunters.com
'   E-mail..... SabresNut42383@roadrunner.com
'   Started.... April 6, 2008
'   Updated.... 22 MAY 2008 - Jon Williams
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


' -----[ Revision History ]------------------------------------------------
'
' 1.00   - Original program
' 1.01   - Jon Williams updated for state-driven operation
' 2.00   - My update removing AP-8 and adding VMusic2
' 2.01   - back to linear with subs for delays and servo processing


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

Sio             PIN     15                      ' Remove Setup; no ULN
TX              PIN     14                      ' SETUP = UP; no ULN
MatSwitch       PIN     13                      ' SETUP = DN; no ULN
HandHeld        PIN     12                      ' SETUP = DN; no ULN
Servo           PIN     8


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

T9600           CON     84
T38K4           CON     6
Open            CON     $8000
OT38K4          CON     Open + T38K4            ' B/R in RC4
OT9600          CON     Open + T9600            ' VM2 baud rate

IsOn            CON     1
IsOff           CON     0

AllOff          CON     %0000
Spot            CON     %0001                   ' K1 relay on
Weep            CON     %0010                   ' K2 relay on
SpotWeep        CON     %0011                   ' K1 % K2 realys on
StrobeFog       CON     %1100                   ' K3 & K4 relays on


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

pos             VAR     Word                    ' servo position
timer           VAR     Word                    ' for delays

skipScare       VAR     Bit                     ' don't use Scare section


' -----[ EEPROM Data ]-----------------------------------------------------


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

Reset:
  LOW Servo
  pos = 750
  timer = 2500
  GOSUB Servo_Pause

  skipScare = IsOff

  SEROUT TX, OT9600, ["VST", CR]                ' stop VMUSIC player
  GOSUB RC4_Reset                               ' clear RC-4


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

Main:
  timer = 100                                   ' preload debounce time
  DO WHILE timer > 0
    GOSUB Refresh_Servo
    IF (MatSwitch = IsOff) THEN                 ' if no input
      timer = 100                               ' reload debounce timer
    ENDIF
  LOOP


Cry:
  GOSUB Refresh_Servo
  SEROUT Sio, OT38K4, ["!RC4", %00, "S", Weep]
  GOSUB Refresh_Servo
  SEROUT  TX, OT9600, ["VRF weep.mp3", CR]
  timer = 20000
  GOSUB Servo_Pause


Suspense:
  SEROUT TX, OT9600, ["VP", CR]                 ' pause weeping
  SEROUT Sio, OT38K4, ["!RC4", %00, "S", AllOff]

  ' turn head slowly to left

  FOR pos = 750 TO 500 ' STEP 2
    GOSUB Refresh_Servo
  NEXT

  timer = 3500
  GOSUB Servo_Pause

  ' turn head back to center

  FOR pos = 500 TO 750 ' STEP 2
    GOSUB Refresh_Servo
  NEXT

  IF (skipScare = IsOn) THEN Finish


Choose:
  IF (HandHeld = IsOn) THEN
    GOTO Scare
  ELSE
    skipScare = IsOn
    GOTO Cry
  ENDIF


Scare:
  GOSUB Refresh_Servo
  SEROUT Sio, OT38K4, ["!RC4", %00, "S", StrobeFog]
  GOSUB Refresh_Servo
  SEROUT TX, OT9600, ["VPF scream.mp3", CR]
  pos = 250
  timer = 5000
  GOSUB Servo_Pause


Finish:
  SEROUT TX, OT9600, ["VRF weep.mp3", CR]
  GOSUB Refresh_Servo
  SEROUT Sio, OT38K4, ["!RC4", %00, "S", SpotWeep]
  timer = 30000
  GOSUB Servo_Pause
  GOTO Reset


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

RC4_Reset:
  SEROUT Sio, OT38K4, ["!!!!!!!RC4", %00, "S", Spot]

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

' Use as a replacement for PAUSE
' -- keeps servo in desired position
' -- load "timer" with desired delay

Servo_Pause:
  DO WHILE timer > 19
    GOSUB Refresh_Servo
  LOOP
  RETURN

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

' Updates servo and decrents timer for time used

Refresh_Servo:
  PULSOUT Servo, pos
  PAUSE 18
  timer = timer - 20
  RETURN

- This is the same code that you wrote and I have not altered it at all.  It just seems strange that I have to press the reset button everytime i plug the board in for the RC-4 to even think about talking to the prop-2.

JonnyMac

Doesn't make sense to me either; almost sounds like a slow-rise in the power supply.  Do this: make sure that the ULN is not affecting the Sio pin (15) -- either use the ULN2003 or cut pin one of the ULN2803.  And go ahead an put the P15 setup jumper in the UP position.  If there is a power-up thing, this will ensure that the Sio is in the idle state from the beginning of the cycle.
Jon McPhalen
EFX-TEK Hollywood Office

LPFreak1283

Jon, I finally got around to checking those things.  I already had the ULN pins snipped, and I added a jumper to the UP position on the prop-2.  Upon plugging in the main power, it still did the same thing.  The RC-4 didn't respond until I pressed the reset button.

Any thoughts??

Cory

JonnyMac

I don't know what's going on.  I just hook it up to my shiny new Prop-2 and the RC-4 is behaving exactly as it should; on power-up there is a short delay for the VMUSIC, then it activates K1.  When the trigger is activated it switches to K2.

This has nothing to do with the problem you're having but I think you should adjust the Refresh_Servo subroutine like this:

Refresh_Servo:
  PULSOUT Servo, pos
  PAUSE 18
  IF timer > 20 THEN
    timer = timer - 20
  ELSE
    timer = 0
  ENDIF
  RETURN


If you call this routine with timer at less than 20 it will rollover and you could end up with an infinite loop thing what may be checking for timer to wind down to zero.
Jon McPhalen
EFX-TEK Hollywood Office