November 21, 2024, 04:17:01 PM

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.


Need a pogram

Started by cooperfan, August 10, 2007, 03:37:59 PM

Previous topic - Next topic

cooperfan

 Hey Jon It's Dean. I need a program to run a "Pig Box" in our Saw room.here is what i need it to do.


Once motion sensor is triggered

Turn on beacon light
Turn on Alarm buzzer
2 second delay
buzzer goes off
Strobe light comes on
also sound starts
1 second delay
water mister on
ater 10 seconds all off
wait 10 seconds and reset


thanks in advance

                           Dean

JonnyMac

August 10, 2007, 03:59:28 PM #1 Last Edit: August 10, 2007, 04:17:28 PM by JonnyMac
You didn't say what kind of audio player you're using, so I assumed an AP-8.

' =========================================================================
'
'   File...... Pig_Box.BS1
'   Purpose...
'   Author.... Jon Williams
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  Mister          = PIN3
SYMBOL  Strobe          = PIN2
SYMBOL  Alarm           = PIN1
SYMBOL  Beacon          = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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

SYMBOL  pirTimer        = B2


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

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00001111                              ' set outputs

  SEROUT Sio, OT2400, ("!!!!!!!AP8", %00, "X")  ' kill sound
  PAUSE 10000
  pirTimer = 0


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

Main:
  PAUSE 10
  pirTimer = pirTimer + 10 * PIR                ' update pir timer
  IF pirTimer < 250 THEN Main                   ' wait for 1/4 sec signal

  Beacon = IsOn
  Alarm = IsOn
  PAUSE 2000
  Alarm = IsOff
  Strobe = IsOn
  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)     ' start sound 0
  PAUSE 1000
  Mister = IsOn
  PAUSE 10000

  GOTO Reset                                    ' stop everything


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


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


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

cooperfan

Yes im using an AP-8  thanks again

Dean