In this activity you will be using the PIR to activate the lamp.
' {$STAMP BS2}
' {$PBASIC 2.5}
OUTPUT 4 ‘Make pin 4 an output so you can switch the solid state relay on and off.
INPUT 0 ‘ Make pin 0 an input so you can see the PIR with the BS2
Sense:
IF (IN0 = 1) THEN relay 'look to see if PIR has detected something and
‘made P0 high, if so then go to subroutine called relay
GOTO sense 'if P0 is not high return to start of program and continue forever…
Relay: 'this subroutine turns relay on.
HIGH 4 'turn the relay on
PAUSE 1000 'keep the relay on for 1 seconds
LOW 4 'turn the relay off
PAUSE 100 ‘keep light off for .1 second
GOTO sense 'return to start of program