Friday, December 14, 2007

ELEGON_prototype_final posting


'{$STAMP BS2} '
{$PBASIC 2.5}
INPUT 0 'set pin 0 as input INPUT
1 PIR1
PIN 0 ' I/O Pin For PIR Sensor PIR2
PIN 1 counter VAR Byte ' Trip Counter

DEBUG CLS ' Clear DEBUG Screen
FOR counter=60 TO 0 'Wait 60 Seconds For PIR Warm-Up
DEBUG HOME,"WARMING UP:", DEC2 counter
PAUSE 1000'Display Counter Every Second
NEXT
counter = 0 'Clear Counter Variable
DEBUG HOME, "WAITING..." ' Display Waiting Message

Main:
DO
IF PIR1 = 1 THEN 'Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 15 ' power to flexinol wire
PAUSE 4000
HIGH 14
PAUSE 4000
HIGH 13
PAUSE 4000
DEBUG HOME, "TRIPPED...", DEC3 counter
DO:LOOP UNTIL PIR1 = 0 'Wait For PIR To Clear
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 15 ' turn off power to flexinol
PAUSE 5000
LOW 14
PAUSE 5000
LOW 13
PAUSE 5000

ENDIF

IF PIR2 = 1 THEN 'Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH 13
PAUSE 4000
HIGH 14
PAUSE 4000
HIGH 15 'power TO flexinol wire
PAUSE 4000
DEBUG HOME, "TRIPPED...", DEC3 counter
DO:LOOP UNTIL PIR2 = 0 'Wait For PIR To Clear
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 13
PAUSE 5000
LOW 14
PAUSE 5000
LOW 15 ' turn off power to flexinol
PAUSE 5000
ENDIF
LOOP


Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?