November 24, 2024, 12:35:13 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


help with drop panel

Started by Rayneman, October 18, 2011, 12:33:24 PM

Previous topic - Next topic

Rayneman

Hi everyone,
I am trying to make a drop panel that is controlled with the prop1. Basically what i need is a program that is triggered by a break beam sensor that then triggers a air solenoid that will cause the piston attached to the drop panel drop and reveal the skeleton. At this time i would like a light to come on inside the box and then trigger the cowlacious 325 sound board which is connected to the servo control board that will controll the servo for the jaw. Then allow the sequence to run its course close the drop panel turn off the light and reset. The light and the piston are going to be controlled by the rc-4 board and ac relays
So i guess the sequence is:

1. activate air solenoid, and active the light
2. Pause for two seconds so the panel drops completely and start the audio board which the sound byte runs for 54 sec
3. Pause for 1 second and then close the drop panel and turn off the light.
the whoole sequence will run for 57 sec.

I know how close it is getting to halloween and how busy everyone must be but i hope that someone can give me a hand with this program.
Thanks in advance

JackMan

October 18, 2011, 06:12:41 PM #1 Last Edit: October 18, 2011, 06:19:23 PM by JackMan
This should work for you but you need to verify the output of your beam sensor. The Check_Trigger portion of this code is based on a negative signal when the beam is broken. If your sensor outputs voltage above 5v you'll need a resistor inline with the PIN connection.


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

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

' Stepping in front of a Beam sensor will activate a light, a cylinder, and audio player.

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

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

SYMBOL Sio          = 7                            ' SETUP = UP; no ULN
SYMBOL BeamBreak    = PIN6                         ' output to P/W  SETUP = UP; no ULN
SYMBOL Audio        = PIN0                         ' Chip player on V+/OUT0

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

SYMBOL  IsOn      = 1
SYMBOL  IsOff     = 0

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

SYMBOL timer      = B2

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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs
  SEROUT Sio, OT2400, ("!RC4", %00, "X")        ' reset all relays

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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5
  IF BeamBreak = 1 THEN Main
  timer = timer + 5
  IF timer < 100 THEN Check_Trigger

  SEROUT Sio, OT2400, ("!RC4", %00, "R", 1, 1) 'turn on relays 1 and 2
  SEROUT Sio, OT2400, ("!RC4", %00, "R", 2, 1)
  PAUSE 2000                                   ' wait 2 seconds
  Audio = IsOn
  PAUSE 250
  Audio = IsOff
  PAUSE 55000                                  ' let audio play 54 seconds, pause 1 second
  SEROUT Sio, OT2400, ("!RC4", %00, "X")       ' reset all relays
  GOTO Main   

Rayneman

Great thank you so much ill let you know how the test goes.