'{$STAMP BS2} '------------------------------------------ 'testmd.bs2 ' 'This program tests the PIR motion detector 'by reading and turning on the red LED when 'motion is detected. motiond var bit 'Motion variable start: gosub getmd 'Get motion detector if motiond = 1 then start1 high 10 'Red LED off goto start 'Loop forever start1: low 10 'Red LED on goto start 'Loop forever '------------------------------------------ 'getmd 'Reads the PIR motion detector and sets 'variable motiond. getmd: motiond = in5 'Get detector state return 'Done