May 04, 2024, 05:50:18 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.


Code Request: DC-16 Control With Prop-1

Started by reddragon, November 09, 2008, 05:41:58 PM

Previous topic - Next topic

reddragon

November 09, 2008, 05:41:58 PM Last Edit: November 09, 2008, 06:05:04 PM by JonnyMac
 Hi Jon,
  I need a code and this is what i would like it to do.

I'm going to be using a mat switch, prop1, DC-16
 and this is the order
  Main:    
    when someone steps to my front door (mat switch)
     - then a buzzer turns on for 10 sec then turns off ( pin #1 on prop1)
     -  my camera above my front door turns on for 20 sec. (on DC-16 pin #2),
         also my camera's that are on ( DC-16 pin #'s 11, 12, 13, 14) come on and stay on for the same 20 sec.       - then go back to main   Thanks in advance,  and cant wait for your book to go on sell.....
     

JonnyMac

November 09, 2008, 06:00:25 PM #1 Last Edit: November 09, 2008, 06:23:15 PM by JonnyMac
Our forum guidelines state in part: "give your post an appropriate Subject line so that it can be searched."  Please stop with the "Need a Code" subject lines or I will simply delete the posts.  Our forums are becoming messy because so many ignore our guidelines and I'm going to have to put my foot down, lest our forums become unusable.  I edited your subject line this time to give you an example of what we consider appropriate.

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 09 NOV 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Buzzer          = PIN0


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000001                              ' set outputs

  SEROUT Sio, Baud, ("!!!!!!!DC16", %00, "X")

Trigger_Release:
  IF Trigger = IsOn THEN Trigger_Release        ' force release


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  Buzzer = IsOn
  SEROUT Sio, Baud, ("!DC16", %00, "S", %00000010, %00111100)
  PAUSE 10000

  Buzzer = IsOff
  PAUSE 10000
  GOTO Reset


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


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


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

JonnyMac

Quotecant wait for your book

A book on programming makes one a good programmer about as much as a book on swimming makes Michael Phelps an Olympic champion.  Like Michael, at some point you're just going to have to jump in.  I'm not waiting on my book to become a better programmer, I'm getting better by experimenting every day.  I have been since I bought my first Stamp 1 (core of the Prop-1) 14 years ago.
Jon McPhalen
EFX-TEK Hollywood Office