November 22, 2024, 04:21:27 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.


User activated air cannon program request

Started by EricTheMannn, August 11, 2013, 09:11:57 PM

Previous topic - Next topic

EricTheMannn

I'm making a prop that allows the guest to shoot two air cannon shots inside a haunted attraction, an actor presses a button and it allows a guest to fire two shots of air on other guest entering a haunted house then deactivates waiting for the actor to press the button again.

I need a very simple program made I lost all memory of the basic stamp terminology and am working on a limited time frame if anyone could help me out on this one it would be greatly appreciated.

Inputs

Two buttons

One on pin5 = Button 1

One on pin6 = Button 2


Outputs

Out 0 = Button led

Out 1 = Air cannon

Pin 5 button opens button on pin 6


Example

Pin 5 activated
Turn Button 2 LED on
Allow two shots on Button 2
Turn Button 2 LED off
Turn Button 2 off

Wait for Button 1


Thank You,

-Eric G





WooHoo

JonnyMac

That's a very quick description so I wrote a very quick program. Give this a try. You will probably have to adjust the valve timing, and you may want to adjust the debounce timing. Note that I'm using PULSIN which means you have to press and release a button for a shot.

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


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


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


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

SYMBOL  Button2         = 6
SYMBOL  Button1         = 5

SYMBOL  AirCannon       = PIN1
SYMBOL  BtnLed          = PIN0


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

SYMBOL  IS_ON           = 1
SYMBOL  IS_OFF          = 0

SYMBOL  SHOT_TIME       = 250                   ' 250ms


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

SYMBOL  timer           = W5                    ' for debounce loop


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

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00000011                              ' P1..P0 are outputs


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

Main:
  PULSIN Button1, 1, timer                      ' look for Btn1 press
  IF timer < 25000 THEN Main                    ' - of at least 250ms

  BtnLed = IS_ON

Shot1:
  PULSIN Button2, 1, timer                      ' look for Btn2 press
  IF timer < 2500 THEN Shot1                    ' - of at least 25ms

  AirCannon = IS_ON
  PAUSE SHOT_TIME
  AirCannon = IS_OFF

Shot2:
  PULSIN Button2, 1, timer
  IF timer < 2500 THEN Shot2

  AirCannon = IS_ON
  PAUSE SHOT_TIME
  AirCannon = IS_OFF

  GOTO Reset                                    ' reset everything



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


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


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