May 20, 2024, 07:17:12 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.


"Thing" head program

Started by vista, October 09, 2011, 11:28:56 AM

Previous topic - Next topic

vista

I had a late request from my friend to create a head with tentacles whipping around it. I envision a foam head with 6" to 1' 1/4 air lines hanging down like ganglia from a head. and delivering 40-60psi to make the air lines whip around. (keeping the head above and away from visitors heads (safety in mind here)

The code that I really need is this
resetting the board
check pir (is on 6)
when movement sensed pause 3 seconds
12vdc solenoid (two way so it's closed until told to open) will activate for 3 seconds and this will be  on V+ and out 1
(or will this hook in elsewhere better.)
pause for 2 seconds
activate for 1 second
then shut down for (no signals for 10 seconds)
then back to main
and wait..

The nice to have functions
Now I have a prop 1 for this but I also have an AP16+ RC4 and relays available to me

So it would be nice to have the AP16 activate with a sound file (scream) during the 3 second air burst and can I use the AP16 to activate 2 LEDs in the eyes of the head or is it easier to wire the LEDs into the prop 1 to turn on during the 3 second air/scream burst...?


Jeff



JackMan

Jeff,
     Give this a try, I haven't tested it but it should work. You can use the onboard relay of the AP-16+ to turn on your LED eyes for the 3 second duration of the scream.

 
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================

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


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


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

SYMBOL Sio    = 7                            'Serial connection  SETUP = UP; no ULN
SYMBOL PIR    = PIN6                         'SETUP = DN
SYMBOL Valve  = PIN1                         'solenoid on V+/OUT1

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

SYMBOL  IsOn   = 1
SYMBOL  IsOff  = 0

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

SYMBOL timer   = B2

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

Power_Up:
  PAUSE 2000                                    ' let AP-16 power up

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs
  SEROUT Sio, OT2400, ("!AP16", %00, "X")       ' reset AP-16
  PAUSE 30000                                   ' 30s PIR warm-up

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

Main:
PAUSE 10000                                     ' 10s post delay
timer = 0                                       ' reset timer

Check_Trigger:
  PAUSE 5                                        ' loop pad
  timer = timer + 5 * PIR                        ' update timer
  IF timer < 200 THEN Check_Trigger              ' wait for 0.2 sec input

  PAUSE 3000                                     ' pause 3s when triggered
  Valve = IsOn
  SEROUT Sio, OT2400, ("!AP16", %00, "PS", 1, 1) ' play SFX01.WAV (scream)
  PAUSE 3000                                     ' pause 3s
  Valve = IsOff
  SEROUT Sio, OT2400, ("!AP16", %00, "X")        ' reset AP-16
  PAUSE 2000                                     ' pause 2s
  Valve = IsOn
  PAUSE 1000                                     ' pause 1s
  Valve = IsOff

  GOTO Main

vista

Thanks, appreciate it.. as soon as my solenoids come in I'll get it all wired up.

Jeff