
[
click here for a printable version (PDF) of this page ]
Real Time Two Button Control of Multiple Prop-1 Events
I want a control board that can trigger any of the events I have programmed
from the Prop-1 in "real time". I don't want to sequence the events off of
one triggering event. For instance, I don't want to hit a trigger, which
then runs a pop-up animation, pauses, then flashes lightning, pause, then a
second pop-up, etc.
As I watch the TOTs if I want to activate the pop-up, I hit this button.
When I want lighting, I hit this button. It's more of a "wizard behind the
curtain" approach, as opposed to the "player piano roll" method I (and I bet
you) generally use. This means when a little one comes up the walk I can
trigger the fog, but not the gigantic blood curdling pop-up. It's not
automated, but it will let me customize the scares, and let's face it - I
want to play with the stuff I built!
Here's the challenge:
- The Prop-1 has 7 input/output pins.
- If I assign a button to each event, I lose an output for each input I use.
All of a sudden I'm very limited. Through the magic of serial
communications, the AP8, FC4 and RC4 can all live on the same output, so at
least I have that going for me. Any animation I trigger that use either 110V
devices, lighting or recorded sounds won't burn any further outputs. But I
have 4 different solenoid valves that need firing, so I need at least 4
outputs.
So with that in mind, here's Prop-1's resources so far:
| PIN |
Usage |
| PIN 1 |
Output 1: 12V Valve |
| PIN 2 |
Output 1: 12V Valve |
| PIN 3 |
Output 1: 12V Valve |
| PIN 4 |
Output 1: 12V Valve |
| PIN 5 |
|
| PIN 6 |
|
| PIN 7 |
Output 7: Serial Communications |
Crap - I only have two PINs left, but I'm going to have a bunch of
animations and events based on mixing and matching the valves, lighting, and
sounds. So what to do?
Well what I did is write a program that uses two buttons, one sets the event,
one triggers. The Prop-1 code keeps track of how many times I hit the "event
selection" button, then once I hit the "action button" it reads the counter
and send the code to whatever animation you set up, then returns it for your
next selection. For visual feedback, I have the RC4 sending light flashes to
a mini 110V low watt bulb with each button press.
So in this fashion I make a little crib sheet for myself, bear in mind this
is just an example to further illustrate the code below:
| Counter |
Event |
| 1 |
Lightning Crash |
| 2 |
Fog Machine |
| 3 |
Monster in Box Lid Slam |
| etc etc etc! |
Below is the code, bear in mind that I've included an example of how you can
setup an event. When it comes right down to it's a pretty simple bit of
code, so go nuts and make it your own.
NOTE: Once you get a feel for the program, remove the 'debug' commands, as
they slow things down a lot.
Click Here to Download the Code
'-------------------Garage of Evil------------------------
' HOW-TO Info for the Home Haunter
' http://www.garageofevil.com/
' Real Time Two Button Control of Multiple Prop-1 Events
' {$STAMP BS1}
' {$PBASIC 1.0}
' ------------------------------------------------------variables
SYMBOL counter_status = B1
SYMBOL cycles = B2
SYMBOL lid_delay = B3
' ------------------------------ -----------------------constants
SYMBOL event_selection = PIN6
SYMBOL action_button = PIN4
SYMBOL Serial = 7
Main:
IF action_button = 1 THEN action
'no action called for - return and loop
IF event_selection = 0 THEN main
'no events being selected? - return and loop
counter_status = counter_status +1
'the event selection was pressed, add one to the counter
SEROUT Serial, OT2400, ("!RC4", %10, "R", 2, 1)
'flash a light, use an output from the RC4 so I dont burn any 12V outputs
PAUSE 100
DEBUG counter_status
'show how many times the event selector has been pressed
SEROUT Serial, OT2400, ("!RC4", %10, "R", 2, 0)
'part of the light flash, in this line it turns it off
PAUSE 100
'remove this pause with the debug commands - withouth it you couldnt see the
last debug before i
DEBUG CR
' clear the debug with the CR command - carriage return -
GOTO main
'loop and keep counting
action:
counter_status = 0
DEBUG "action time"
IF counter_status = 1 THEN Lightning_Crash
IF counter_status = 2 THEN Fog_Machine
IFcounter_status = 3 THEN Monster_Lid
Lightning_Crash:
SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 1)
PAUSE 250
SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 0)
SEROUT Serial, OT2400, ("!AP8", %00, "P", 1)
GOTO Main
Fog_Machine:
SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 1)
PAUSE 2000
SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 0)
GOTO Main
Monster_Lid:
FOR cycles = 1 to 5
RANDOM lid_delay
NEXT
lid_delay= lid_delay // 200 + 100
cycles = 0
FOR cycles = 1 to 8
HIGH 1
PAUSE lid_delay
LOW 1
NEXT
GOTO Main
Click Here to Download the Code

This page was last modified on: October 09, 2007 07:48:55 pm