November 23, 2024, 06:32:00 AM

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.


Bubble Blaster Effect

Started by flashular, September 28, 2007, 11:33:27 AM

Previous topic - Next topic

flashular

Using the same hardware (prop1 + quad triac board) I used in the Wind and Weather Effect (http://www.efx-tek.com/php/smf/index.php?topic=251.0), I created another Haunted house feature that uses a bubble machine, a fan, some speakers, blacklights, and strobelight to hypnotize and stun victims. This works pretty well for both kids and adults in haunted house applications.

To see the hardware, check here:  http://67.131.73.173/StupidlySimple/index.htm

In this feature, the PIR motion sensor is used to take the system out of a quiet state (only standby light is active) when someone enters the room. At that point, random computerish sounds can be heard and bubbles start streaming into the room under black light (I spiked the bubble juice with black light sensitive additive so they glow eerily).

As the victim begins to interact with the bubbles, the motion sensor monitors movement and raises the sound pitch, gradually increasing the tension. If the victim stays in the room for long enough, a strobe light is activated, effectively freezing the bubbles in place while the sound system makes a prolonged explosion sound. After a short time the system resets to standby mode awaiting the next victim.

Here is the code:



' {$STAMP BS1}
' {$PBASIC 1.0}
' -------------------------------------------------------------------
' use a PIR motion sensor to trigger a light and tone
' -------------------------------------------------------------------
'
' PIN 0 - sound    OUT - audible indication of state
' PIN 1 - standby  OUT - active when waiting for motion
' PIN 2 - movement OUT - active whenever movement is detected
' PIN 3 - caution  OUT - active from first movement until reset
' PIN 4 - alarm    OUT - active once excited to the point of alarmed
'
' PIN 7 - sensor   IN  - PIR sensor (wired into the 3 pin connector )
'
' -------------------------------------------------------------------

' pin assignments

SYMBOL  Speaker      =    0       ' pin 0 - attach speaker for audible status
SYMBOL  StandByOut   = PIN1       ' pin 1 - active when waiting for motion
SYMBOL  MovementOut  = PIN2       ' pin 2 - active when movement is detected
SYMBOL  CautionOut   = PIN3       ' pin 3 - active while deciding to trigger alarm
SYMBOL  AlarmOut     = PIN4       ' pin 4 - active when alarm is triggered
SYMBOL  MotionSensor = PIN7         ' pin 7 - attach PIR sensor on 3 pin jumper

' variables

SYMBOL  Tone=B1                   ' stepped tone for repeated detection
SYMBOL  Blips=W2                  ' alarm blip counter
SYMBOL  MoveCnt=W3                ' counts up/down motin

' I/O configuration

DIRS  = %01111111                 ' configure inputs/outputs ( only PIN7 input )
PINS  = %00000000                 ' default states to zero


Reset:

   StandByOut  = 1                ' standing bye
   MovementOut = 0                ' no motion detected
   CautionOut  = 0                ' nothing to be cautious about
   AlarmOut    = 0                ' nothing to be alarmed about
   Tone        = 20               ' start at a low tone
   MoveCnt     = 0                ' no detection
   PAUSE 100                      ' wait for system to reset


ReadSensor:

  MovementOut = MotionSensor      ' copy sensor state out to the movement light
  IF MotionSensor = 1 THEN Excite ' if the sensor is hot excite the system
  GOTO Relax                      ' otherwise relax the system


Excite:

  StandByOut = 0                  ' we're no longer standing by
  CautionOut = 1                  ' we are now cautious
  MoveCnt    = MoveCnt + 1        ' increment motion count
  IF MoveCnt >= 250 THEN Alarm    ' when you're too excited alarm
  RANDOM Tone                     ' get a new random number
  Tone = Tone + MoveCnt
  IF Tone > 120 THEN ReadSensor   ' don't pick goofy values
  SOUND Speaker, ( Tone , 8 )     ' put out a warning tone

  GOTO ReadSensor                 ' go read the sensor again


Relax :

  IF MoveCnt <= 20 THEN Reset     ' when you're bored reset
  SOUND Speaker, ( MoveCnt, 3 )   ' put out a warning tone
  MoveCnt = MoveCnt - 1           ' stand down a bit
  GOTO ReadSensor                 ' go read the sensor again


Alarm:

  AlarmOut = 1                    ' trigger the alarm
  FOR Blips = 0 TO 100            ' iterate the alarm
    SOUND Speaker,( 5,  4 )      ' first tone
    SOUND Speaker,( 12, 4 )      ' second tone
  NEXT                            ' return iteration

  GOTO Reset                      ' reset the system