Tuesday, October 21, 2008
two LED & flexinol with two PIR sensor
1. Only if both triggered, both lights will be on
'{$STAMP BS2}'
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
'DO
IF PIR = 1 THEN
IF PIR2 = 1 THEN
counter = counter +1
HIGH 6
HIGH 8
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
IF PIR2 = 1 THEN
IF PIR = 1 THEN
counter = counter +1
HIGH 6
HIGH 8
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 6
LOW 8
'PAUSE 100
ENDIFENDIF
'{$STAMP BS2}'
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
'DO
IF PIR = 1 THEN
IF PIR2 = 1 THEN
counter = counter +1
HIGH 6
HIGH 8
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
IF PIR2 = 1 THEN
IF PIR = 1 THEN
counter = counter +1
HIGH 6
HIGH 8
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 6
LOW 8
'PAUSE 100
ENDIFENDIF
2.Independent
'{$STAMP BS2}'
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
DO
IF PIR = 1 THEN
counter = counter + 1
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2
LOW 6
PAUSE 100
ENDIF
IF PIR2 = 1 THEN
counter = counter +1
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 8
ENDIF
PAUSE 100
LOOP
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
DO
IF PIR = 1 THEN
counter = counter + 1
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2
LOW 6
PAUSE 100
ENDIF
IF PIR2 = 1 THEN
counter = counter +1
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 8
ENDIF
PAUSE 100
LOOP
3.Any possibility
'{$STAMP BS2}'
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
'DO
IF PIR = 1 THEN
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
IF PIR2 = 1 THEN
counter = counter +1
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 2
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
IF PIR2 = 1 THEN
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
IF PIR = 1 THEN
counter = counter +1
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
'{$STAMP BS2}'
'{$PBASIC 2.5}'
PIR PIN 0
PIR2 PIN 15
counter VAR Byte
Main:
'DO
IF PIR = 1 THEN
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
IF PIR2 = 1 THEN
counter = counter +1
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
LOW 2
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
IF PIR2 = 1 THEN
HIGH 8
DEBUG HOME, "TRIPPED2...", DEC3 counter
DO : LOOP UNTIL PIR2 = 0
DEBUG HOME, "CLEARED2...", DEC3 counter
IF PIR = 1 THEN
counter = counter +1
HIGH 2
HIGH 6
DEBUG HOME, "TRIPPED...", DEC3 counter
DO : LOOP UNTIL PIR = 0
DEBUG HOME, "CLEARED...", DEC3 counter
LOW 2
LOW 6
LOW 8
'PAUSE 100
ENDIF
ENDIF
Group-Guillermo, Heejoo, Derik, Sang Wan, Adolfo