PIR lighting control
Hello, I am trying to control the lights in the downstairs of my house using a PIR sensor. actually the goal is to control the lights in each room using a PIR for each room. I am able to set up program a BS2 to control the lights in the first room by programming a counter and inc/dec the counter so that the lights stays on for a short time after no motion in the room. I am at a total loss as to how to do this for multiple rooms........................any direction is much appreaciated.
thanks
thanks
Comments
ON_TIME CON 10 ' 10 MINUTES TIMER VAR BYTE ' SECONDS TIMER CNTR1 VAR BYTE ' PIR1 TIMER CNTR2 VAR BYTE ' PIR2 TIMER DO IF PIR1 = 1 THEN OUTP1 = 1 CNTR1 = ON_TIME ENDIF IF PIR2 = 1 THEN OUTP2 = 1 CNTR2 = ON_TIME ENDIF PAUSE 1000 TIMER = TIMER + 1 IF TIMER = 60 THEN ' ONE MINUTE ELAPSED IF CNTR1 > 0 THEN CNTR1 = CNTR1 - 1 ELSE OUTP1 = 0 ENDIF IF CNTR2 > 0 THEN CNTR2 = CNTR2 - 1 ELSE OUTP2 = 0 ENDIF TIMER = 0 ENDIF LOOP
Thanks again
Steven