November 23, 2024, 05:00:09 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.


Need help with a Prop-1 Code and prop-pots

Started by MrCraigar, October 15, 2008, 03:56:43 PM

Previous topic - Next topic

MrCraigar

October 15, 2008, 03:56:43 PM Last Edit: October 18, 2008, 08:40:19 AM by MrCraigar
After reading several other posts and docs written by Jon I have retitled my post. I have also learned a lot but still would like to verify my questions below.

I have never used a Prop-1 before and I'm attempting to build a Monster in a Box. I'm using the one from http://www.cindybob.com/halloween/mib/  as my guide but I'm not sure about a couple of things under the control section. I would like to use the prop-pots for the delay and the timeout pots instead of the 2 - 25K Linear Taper Potentiometers/0.1µF Ceramic Capacitors but after reading the docs about the prop-1 and the prop-pots I'm unsure about the connections and the code. I'm also using a Cowlacious Audio Recorder Player board, with 17120 Chip. I'm also not sure about the relays or a couple of the other parts on the proto board. Like I said I'm brand new at the control part of this. I have the prop-1 board and 2 prop-pots on there way now.  (I have them now and have been playing with the trained. This is fun!)

Is this something you could look at for me and advise? Here is the code and the control schematic is on their website.

Thank you so much for any help. I cant wait to finish the build on this. It's been a great challenge.

' =========================================================================
'
'   File....... MIB2005.bs1
'   Purpose.... Monster In A Box Prop Control
'   Author..... Robert Hole
'   Web...      www.halloween.cindybob.com
'   Started.... 20 Aug 2005
'   Updated.... 25 Feb 2006
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL  Trigger = PIN7
SYMBOL  Test    = PIN6
SYMBOL  FOG     = PIN2
SYMBOL  Motor   = PIN0
SYMBOL  Lights  = PIN1
SYMBOL  SND     = PIN3
SYMBOL  IPause  = PIN4
SYMBOL  TOut    = PIN5

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

SYMBOL Repeat       = 2      'Number of times the pattern will repeat
SYMBOL MaxFogTime   = 1000

' -----[ Variables ]-------------------------------------------------------
SYMBOL  DoFog           = B3
SYMBOL  Triggered       = B1
SYMBOL  Reps            = B2
SYMBOL  LightLoop       = B0
SYMBOL  wTime           = W2
SYMBOL  rTime           = W4
SYMBOL  pTime           = W5
SYMBOL  FogOnTime       = W3

' -----[ Initialization ]--------------------------------------------------
LOW 0       'Motor Off
LOW 1       'Lights Off
LOW 2       'Fog Off
LOW 3       'Sound Off
pTime=7864
DoFog=0     'No Fog if left at 0

' -----[ Program Code ]----------------------------------------------------
Start:
  LOW 0       'Motor Off
  LOW 1       'Lights Off
  LOW 2       'Fog Off
  LOW 3       'Sound Off
  DEBUG CLS,"Ready",CR


Main:
'  DEBUG "Ready",CR
  Triggered=0
  IF PIN7=0 AND PIN6=0 THEN Main
  Triggered=PIN7
  IF Triggered=1 THEN DoWait
  IF Triggered=0 THEN DoTesting

Run:
  FOR Reps = 1 TO Repeat
    HIGH 0      'Motor On
    HIGH 1      'Lights On
    HIGH 3      'Sound On
    DEBUG "Motor and sound on: Rep",#Reps,CR

    DoFog=1     'Set Fog to run
    GOSUB LightIt

    LOW 0       'Motor Off
    LOW 1       'Lights Off
    LOW 3       'Sound Off
    DEBUG "Motor and sound off.",CR,CR
    RANDOM rTime
    pTime = rTime // 3 +1 * 1000
    PAUSE pTime
  NEXT

  IF Triggered=0 THEN Start
  wTime=0
  POT 5, 90, wTime          ' read timeout pot level
  PAUSE 200
  wTime=wTime /4            ' 0 to 60 secs
  wTime=wTime-1

  FOR reps=wtime TO 0 STEP -1
    DEBUG CLS,"Lock out for ",#reps,"seconds"
    PAUSE 1000
  NEXT

  GOTO Start

' -----[ Subroutines ]-----------------------------------------------------
LightIt:
  IF DoFog=1 THEN DoFogOn
Continue:
  DEBUG "Lights Flashing",CR
  FOR LightLoop=1 TO 10
    HIGH 1      'Lights On
    'DEBUG "   Light on: ",#LightLoop,CR
    RANDOM rTime
    pTime = rTime // 6 +1 * 100
    FogOnTime=FogOnTime+pTime
    'DEBUG #FogOnTime
    IF FogOnTime>=MaxFogTime AND PIN2=1 THEN DoFogOff
Continue2:
    'DEBUG "   Lights On ",#pTime,CR
    PAUSE pTime
    LOW 1       'Lights Off
    'DEBUG "   Lights off",CR
    RANDOM rTime
    pTime = rTime // 5 +1 * 100
    'DEBUG "   Lights Off ",#pTime,CR
    PAUSE pTime
  NEXT
  DEBUG "Lights Done", CR
  RETURN

DoFogOn:
  FogOnTime=0
  HIGH 2      'Fog on
  DEBUG "Fog is on",CR
  GOTO Continue

DoFogOff:
  LOW 2      'Fog off
  DEBUG "Fog is off", CR
  GOTO Continue2

DoWait:
  wTime=0
  POT 4, 87, wTime          ' read intial pause pot level
  PAUSE 200
  wTime=wTime /8                 ' 0 to 30 secs
  FOR reps=wTime TO 0 STEP-1
    DEBUG CLS,"Triggered - Pause for ", #reps,"seconds",CR
    PAUSE 1000
  NEXT
  DEBUG CLS
  GOTO Run

DoTesting:
  DEBUG CLS,"  >>>> Testing <<<<",CR,CR
  GOTO Run

JonnyMac

Sorry, I thought I had answered this earlier.  Do me a favor: describe how you want the program to behave -- in detail -- and let me know how you want to use the Prop-Pots, etc.   It's easier for me to write a program from scratch than deconstruct an existing program that may not be what you want, anyway.
Jon McPhalen
EFX-TEK Hollywood Office

MrCraigar

Thank you for getting back to me. I have learned more everyday from reading your posts and articles. What I would like it to do is:
When the PIR is triggered the fog and lights start.
The next step would be the sound and motor start after a short delay. I'm not sure of the timing here, maybe 1 second or would this be a function of the 1st prop pot?
The sound bite is 10 seconds long so everything should end at that point. I'm using a CAR/P 300 which I would imagine will connect and be triggered similar your threads http://www.efx-tek.com/php/smf/index.php?topic=786.0  and http://www.efx-tek.com/php/smf/index.php?topic=736.0
The last thing would be a delay before the PIR could be triggered again. I would think this would be a function of the second prop pot? Or can it be in the code?
There is also a test button in the example I'm using.
After reading countless post I'm not sure if I should use the prop-pots which could only be adjusted from inside the box or the Potentiometers which could be mounted and adjusted from out side the box. What do you suggest? I have both. Also please remember I'm brand new to this and any suggestions would be greatly appreciated.
Thanks again for your help. I have never seen a board as helpful as this

MrCraigar

Hi Jon,

Any chance you can get to this by the weekend? I'm going to be building the control part of my MIB Saturday.

Thanks - Craig

JonnyMac

Craig,

Let's start simple; using the Prop-Pots means more effort than you have time to exert between now and Halloween.  This program will get you going with a working prop.

' =========================================================================
'
'   File...... Craig_MIB.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 23 OCT 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Trigger         = PIN7                  ' SETUP = DN
SYMBOL  Test            = PIN6                  ' SETUP = DN
SYMBOL  TOut            = PIN5                  ' (not used)
SYMBOL  IPause          = PIN4                  ' (not used)
SYMBOL  Audio           = PIN3
SYMBOL  Fogger          = PIN2
SYMBOL  Lights          = PIN1
SYMBOL  Motor           = PIN0


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2
SYMBOL  tstTimer        = B3

SYMBOL  delay           = W4
SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00001111                              ' set outputs

  PAUSE 60000                                   ' warm-up/delay


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

Main:
  timer = 0                                     ' reset timer
  tstTimer = 0

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timers
  IF timer > 100 THEN Run_MIB
  tstTimer = tstTimer + 5 * Test
  IF tstTimer > 100 THEN Run_MIB
    GOTO Check_Trigger

Run_MIB:
  Fogger = IsOn
  Lights = IsOn

  delay = lottery // 2001 + 1000                ' random, 1 to 3 seconds
  PAUSE delay

  Audio = IsOn                                  ' start CAR/P
  PAUSE 250
  Audio = IsOff

  Motor = IsOn
  PAUSE 10000

  GOTO Reset                                    ' everything off


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

MrCraigar

Thanks Jon! I'll give you an update Monday(I hope).

By the way Scary Terry says "Hi". He has been helping me also.

Craig

MrCraigar