November 12, 2024, 11:31:43 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Halloween is approaching...

Started by a94cobra, October 20, 2010, 02:52:00 PM

Previous topic - Next topic

a94cobra

Got my props builts.  But having difficulty understanding what I need to put in my controller to make it do what I want. 

I have programmed basic before so I am not a total noob.  I have the Prop-2.  Looking for some help to get started in the right direction.  So if someone could show me a sample or point me to the same thing I would be grateful.

1st prop.  I've got a skull that pops out of a barrel.  Pops up on a air cylinder.  Shoots water off a 12v pump.  And has a smoke machine hooked up.  All of it needs to be triggered somehow off the mat switch.

Operation.  Someone steps on the mat switch, smoke machine starts, few seconds later skull pops up(air), another second or two shoots water for two seconds.  Then all turns off and doesn't work again for at least 30seconds.

I can wire up my own relays and things once I figure out what all I need to make the program work. 

I have two other props, but I won't bother you guys with those unless I can't figure something out after I get this one working.

Thanks.


JonnyMac

October 20, 2010, 04:08:21 PM #1 Last Edit: October 20, 2010, 04:10:53 PM by JonnyMac
In future, please post Prop-2 programming requests in the Prop-2 forum.  There are already lots of Prop-2 programming examples there.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Here's any easy program to get you started.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Trigger         PIN     14                      ' SETUP = DN

Spitter         PIN     4                       ' spit solenoid, V+/OUT4
PopUp           PIN     2                       ' pop-up solenoid, V+/OUT2
Fogger          PIN     0                       ' relay, V+/OUT0


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

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

Yes             CON     1
No              CON     0


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

timer           VAR     Word
delay           VAR     Word
lottery         VAR     Word


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

Reset:
  OUTH = %00000000 : OUTL = %00000000           ' clear all
  DIRH = %00000000 : DIRL = %00010101           ' set outputs

  PAUSE 30000                                   ' reset delay


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

Main:
  timer = 0
  DO WHILE (timer < 100)                        ' debounce = 100ms
    RANDOM lottery
    timer = (timer + 5) * Trigger
    PAUSE 5
  LOOP

  Fogger = IsOn                                 ' activate fogger relay
  delay = lottery // 2001 + 1000                ' random, 1 to 3 secs
  PAUSE delay

  PopUp = IsOn                                  ' pop up
  Fogger = IsOff                                ' kill fogger
  PAUSE 2000                                    ' hold 2 secs

  Spitter = IsOn                                ' spit
  PAUSE 2000

  GOTO Reset                                    ' everything off


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


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


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

a94cobra

Oh sorry, I guess I did put that in PT forum.  Thanks for moving.   Is there a difference between Prop-1 and Prop-2 other than number of outputs?

That is a great start.  I'm sure that saved me a months worth of work.  Thanks so much.  Now when I get around to adding my other props, Would I then just change the Do While section to see more than one trigger?


JonnyMac

Yes, there is a difference (which a little basic research would have revealed <wink>).  The Prop-1 uses the BS1 processor and has eight IOs.  The Prop-2 uses the BS2 processor and has 16 IOs.

We have a documentation section here:
-- http://www.efx-tek.com/php/smf/index.php?board=15.0

... in which you will find the Prop-1 and Prop-2 docs that you can review.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

Welcome to the forums. You ask this question. Is there a difference between Prop-1 and Prop-2 other than number of outputs? Yes, there is, it is the memory. The Prop1(Basic Stamp 1) has less memory than the Prop2(Basic Stamp 2) Here is the specs on both the Prop1(Basic Stamp 1) and the Prop2(Basic Stamp 2)

Prop1(Basic Stamp 1)
Processor Speed: 4 MHz
Program Execution Speed: ~2,000 instructions/sec.
RAM Size: 16 Bytes (2 I/O, 14 Variable)
EEPROM (Program) Size: 256 Bytes, ~80 instructions

Prop2(Basic Stamp 2)
Processor Speed: 20 MHz
Program Execution Speed: ~4,000 instructions/sec.
RAM Size: 32 Bytes (6 I/O, 26 Variable)
EEPROM (Program) Size: 2K Bytes, ~500 instructions

I hope this answer your question you have. 
William Stefan
The Basic Stamp Nut

JonnyMac

This thread, which was started in the wrong forum has now gone off topic so I'm locking it.
Jon McPhalen
EFX-TEK Hollywood Office