November 22, 2024, 03:43:56 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.


Triggering a Mister and a light with a Prop 1 and PIR sensor

Started by innovativemagic, August 23, 2007, 05:21:34 PM

Previous topic - Next topic

innovativemagic

Complete Newbie here!  Just purchased a Prop 1 starter kit. 

I would like to be able to control a 12 volt solonoid and a light.

When the person triggers the PIR the Light comes on for 5 sec. 
After the first 2 sec the mister activates.  for 3 sec.  Then resets in 5 sec. to be triggered again.  I am completely clueless on how to write this program?  Any help would be appreciated.

Thanks!

JonnyMac

I've been told that I'm completely clueless, too, but I do know how to write Prop-1 programs.  Here's code that matches your requirement.  You don't say how you're controlling the light.  If it's a 120 VAC light then you'll need a relay connected to OUT0 (other side to V+) to switch the AC for the light.

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


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


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


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

SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  Mister          = PIN1
SYMBOL  Light           = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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

SYMBOL  pirTimer        = B2                    ' for debouncing PIR


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

Reset:
  PINS = %00000000
  DIRS = %00000011                              ' set outputs

  PAUSE 30000                                   ' let PIR warm-up


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

Main:
  pirTimer = 0

PIR_Wait:
  PAUSE 10
  pirTimer = pirTimer + 10 * PIR                ' update timer
  IF pirTimer < 250 THEN PIR_Wait

  Light = IsOn
  PAUSE 2000
  Mister = IsOn
  PAUSE 3000
  Mister = IsOff
  Light = IsOff

  PAUSE 5000
  GOTO Main


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


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


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