November 24, 2024, 06:23:28 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.


Jack in the box

Started by sinstar, August 14, 2012, 08:42:31 PM

Previous topic - Next topic

sinstar

How do I make the prop-1 do this??

=========================================================================
======================================================================
>
>
> ' -----[ Program Description
> ]---------------------------------------------
>
> 00 seconds- Ir sensor tripped
>                     Audio is triggered (Cowlacious Cap-200)
> 20              - Smoke is triggered (3-6 seconds)
> 23              - Smoke off
> 30              - box Leds start strobing (1/4 second intervals)
> 40              - Eye leds start strobing (3/4 second intervals)
>                     box and eye leds are strobing with body leds
>                     Body leds starts flashing 1/2 sec.on 1/2 sec.off till end.
>                     Solenoid activates air piston 4 seconds on
>                                                                 .5         off
>                                                               1.0         on
>                                                                 .5         off
>                                                                 .5         on
>                                                                 .5         off
>                                                               1.5         on
>                                                                .75        off
>                                                              1.25        on
>                                                               1.0         off
>                                                               1.0         on
> 52           _ Air solenoid power off
>                   Box Led strobes off
>                   Led eyes off
>                   Led body off
>                   Pause for 2 minutes (prop can not be triggered for 2 minutes)
>
> ' -----[ Revision History
> ]------------------------------------------------
>
>
> ' -----[ I/O Definitions
> ]-------------------------------------------------
>
> SYMBOL  Audio                   = PIN7                  ' SETUP = DN
> SYMBOL  Trigger (ir)           = PIN6                  ' SETUP = DN, NO = R > + W
> SYMBOL  Smoke                 = PIN5
> SYMBOL  box Strobe Leds  = PIN4
> SYMBOL  Eye Leds              =PIN3
> SYMBOL Body Leds             =PIN2     
=========================================================================

bsnut

From what I can tell from your post it looks like a program you copied or this is your description of how you want your program to work. If so, I can write the code for you based on the info you provided.
William Stefan
The Basic Stamp Nut

JonnyMac

August 14, 2012, 09:31:55 PM #2 Last Edit: August 14, 2012, 09:33:54 PM by JonnyMac
The best approach is sequencer style so I used Vixen to create the starter program, then modified it for your long inter-program delays (this time is also used for PIR warm-up).

Note that I re-arranged the pin #s to make entry into Vixen easier as I was following your list.  You'll need to update your wiring if it's already connected.  With this style you cannot simply redefine the pins at the top because the outputs are embedded in the table.  Note, too, that this just barely fits in the Prop-1 program space.

' =========================================================================
'
'   Source material updated 14 AUG 2012 by EFX-TEK
'
'   File...... vxn__jack_in_box.bs1
'   Purpose...
'   Author....
'   E-mail....
'   Created... 14 AUG 2012 - Generated by Vixen Prop-1 Sequencer Plug-in
'   Updated... 14 AUG 2012 - modified by JonnyMac
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Triggered, table-drive sequencer capable of driving six control outputs.
' P6 is used as the trigger input, P7 is used for audio start when that
' option has been enabled.
'
' Note: When using the AP-16+ or AP-8 in serial mode you must replace the
'       ULN2803 with ULN2003, or clip pin 1 of the ULN2803 for audio start
'       on P7.
'
' Note: When use active-high input (PIR, etc) the P6 SETUP jumper should
'       be in the DN position and the input is between P6.R (red) and
'       P6.W (white).  When an active-low (open-collector, NPN) input is
'       used the ULN pin should be clipped and the P6 SETUP jumper is
'       in the UP position.  For active-low the connection is between
'       P6.B (black, ground) and P6.W (white, signal).


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


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

SYMBOL  AudioStart      = 7                     ' SETUP = out
SYMBOL  Trigger         = PIN6                  ' SETUP = (see above)

SYMBOL  NotUsed5        = PIN5

SYMBOL  Solenoid        = PIN4
SYMBOL  BodyLEDs        = PIN3
SYMBOL  EyeLEDs         = PIN2
SYMBOL  BoxLEDs         = PIN1
SYMBOL  Smoke           = PIN0


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

SYMBOL  IsActive        = 1
SYMBOL  IsNotActive     = 0

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0

SYMBOL  Started         = 1
SYMBOL  NotStarted      = 0

SYMBOL  EventDelay      = 250


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

SYMBOL  showBits        = B0                    ' output + control bits
SYMBOL   endOfShow      =  BIT7                 ' 1 = stop when timer done

SYMBOL  timer           = B2                    ' for timing
SYMBOL  pntr            = B3                    ' step pointer


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

Power_Up:


Reset:
  PINS = %00000000                              ' clear pins
  DIRS = %00111111                              ' P0..P5 are outputs

  PAUSE 60000                                   ' PIR warm-up / reset delay
  PAUSE 60000


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

Main:
  timer = 0

Check_Trigger:
  PAUSE 5
  timer = timer + 5
  IF Trigger = IsNotActive THEN Main            ' wait for trigger
  IF timer < 100 THEN Check_Trigger             ' debounce 100ms

Reset_Show:
  pntr = 0                                      ' point to start of show

Start_Audio:
  HIGH AudioStart                               ' activate player

Play_Show:
  READ pntr, showBits                           ' get step
  PINS = showBits & %00111111                   ' update outputs
  pntr = pntr + 1                               '   point to timing
  READ pntr, timer                              '   read it
  pntr = pntr + 1                               ' point to next step

Step_Timing:
  IF timer = 0 THEN Next_Step                   ' timer expired?
    PAUSE EventDelay                            ' no, time on "tic"
    timer = timer - 1                           ' decrement timer
    GOTO Step_Timing                            ' check again

Next_Step:
  INPUT AudioStart                              ' release (if used)
  IF endofShow = IsOn THEN Reset                ' done?
    GOTO Play_Show                              ' keep going


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


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

Show_Data:
'          +------------ end of show bit
'          |
'          | +---------- OUT5 is not used
'          | |+--------- Solenoid
'          | ||+-------- Body LEDs
'          | |||+------- Eye LEDs
'          | ||||+------ Box LEDs
'          | |||||+----- Smoke
'          | ||||||
'          | ||||||  +-- timing multiplier (1 to 255)
'          | ||||||  |
  EEPROM (%00000000, 80)
  EEPROM (%00000001, 12)
  EEPROM (%00000000, 28)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00011110, 1)
  EEPROM (%00011100, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010000, 1)
  EEPROM (%00011010, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010100, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00010010, 1)
  EEPROM (%00010000, 1)
  EEPROM (%00011110, 1)
  EEPROM (%00011100, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010000, 1)
  EEPROM (%00001010, 1)
  EEPROM (%00001000, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010100, 1)
  EEPROM (%00011110, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00011110, 1)
  EEPROM (%00011100, 1)
  EEPROM (%00000110, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00011010, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010100, 1)
  EEPROM (%00011110, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00000010, 1)
  EEPROM (%00000000, 1)
  EEPROM (%00001110, 1)
  EEPROM (%00011100, 1)
  EEPROM (%00010110, 1)
  EEPROM (%00010000, 1)
  EEPROM (%00011010, 1)
  EEPROM (%00011000, 1)
  EEPROM (%00000110, 1)
  EEPROM (%00000100, 1)
  EEPROM (%00001110, 1)
  EEPROM (%00001000, 1)
  EEPROM (%00010010, 1)
  EEPROM (%00010000, 3)
  EEPROM (%10000000, 1)
Jon McPhalen
EFX-TEK Hollywood Office

sinstar



Posts: 5










Jack in the box

« on: August 19, 2012, 11:12:25 PM »

Remove


This program is needs refinements.  The sound board I'm using is the Cowlacious cap-200.  This is the code that works with the screaming lady which uses the cap-200.

Audio = IsOn                                  ' start audio player
PAUSE 250
Audio = IsOff

I have tried to paste this into the code many ways.  The error message that keep coming up is, the label is missing ":".

The next problem is the light are strobing too slow.  1/4 second intervals does not do it.  1/8 works better for the box.  The body and eyes are fine.  The best way for the box strobes to flash is for the first 10 seconds 1/4 second intervals then the rest of the show they flash 1/8 second intervals.  I have tried to modify this program on my own. I have switched the event delay to 125 I got the show to speed up.  Then I tried to lengthen the show by doubling up on this code [EEPROM (%00010010, 1)] some other error message came up something to the effect writing over code I do not remember. 

The next thing I for see having to be adjusted is the solenoid I believe all I will have to do is Change the 1 to a 0 on one of the lines.  That should shorten the duration the solenoid is on for. Need some more help got to get this done.

JackMan

The reason you are getting "Label is missing" is that Audio is not listed in the I/O definitions, it's listed as AudioStart. Jon will have to help you out with the other items.

sinstar

I have the equipment all hooked up now.  Some more adjustment are needed.  The body lights need to stay lit for and additional 1.5 seconds.  They also need to be more on than off.  3/4 seconds on and 1/4 seconds off.  The other change that I would like to experiment with is 4 second on solenoid.  It may need to be adjusted 1/2 second shorter or 1/2 longer.  The solenoid I would like to adjust myself (tip would be appreciated).

JonnyMac

Here's the problem: you can't do it one way or the other, you need to combine both.  As a pure coded program, it's just maniacal and too hard to code; as a pure-bit banger program you have far too many events to deal with in the Prop-1 (it has a very small memory footprint).   Elements of both styles need to be combined and even then, you may have to make some adjustments to what you get versus what you want.  Again, it comes down to memory, and when we go with the smallest product we are sometimes forced to make these adjustments to fit the container.
Jon McPhalen
EFX-TEK Hollywood Office

sinstar

The Jack in the box looks great move fine flashes good enough.  The last part is Cowlacious v-trigger will not activate.  If I plug in the code

Audio = IsOn                                  ' start audio player
PAUSE 250
Audio = IsOff

and change the I/0

SYMBOL  Audio           = PIN7                  ' SETUP = DN

Other error codes come up.   I have deleted, changed, and adjusted the program till it loads.  Still no v-trigger.  I load another program with the above data, and the board is triggered(no error in weiring).  I can not do any more with this.  The lights, smoke, & solenoid are timed just right.  I just need the v-trigger pulse to be sent out once the (Ir) motion sensor is triggered.  Sleep deprived and frustrated Please help.   

JonnyMac

Really?  This section:

Start_Audio:
  HIGH AudioStart                               ' activate player


...is activating the P7 pin; it's another way of doing the code snippet you show.  Your event timing is 250ms which matches the code you show. This is all to say that the program is doing what you're asking for, just differently.

Please attach your working program so I can have a look at it.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

I suspect that 250ms is not long enough for the player you have -- we've seen this.  If you move the Cowlacious connection to P5 (which is not presently used) and then change the first table element from:

  EEPROM (%00000000, 80)

to:

  EEPROM (%00100000, 80)

...you will get a 20s pulse to the Cowlacious -- plenty long enough and will be released before you get any looping.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

How are you connecting between the Prop-1 and the Cowlacious board? A picture would be helpful.
Jon McPhalen
EFX-TEK Hollywood Office

sinstar

I'm connecting to v+ to out 7, and then to the V-trigger.  The pulse was too short.  Your suggestion of changing the 0 to a 1 worked.  With this new knowledge I added

HIGH AudioStart                               ' activate player
  PAUSE 250

This is long enough trigger the v-trigger on the Cowlacious sound board.  I know it changed the timing.  It moved the way it need to go, I maybe adding more pause.  Thanks for all the help the Jack in a box is going to scare the pants off them.