Hello, i am currently doing an auto lighting system using LDR and Security System using PIR sensor and LCD display. I am having problems with the Security system part. Imagine 3 rooms, one room on the left side has a PIR sensor and 2 LED's( one related to PIR and one more connected to LDR).One room in the middle is the post guard in which the LCD display and a blinking LED is attached to it. The last one on the right has an LDR and one LED. I am having problems with the PIR sensor room. Firsly, let me explain, the LDR turns on when you flash a light on it(basic). So when the LDR is shed with light, one LED from the room with PIR lights up,and the one with LDR lights up aswell.Think of it as a auto lighting system inside an office.The two being rooms in an office.
So "during the night", when the PIR senses a motion, the other LED in that room, lights up(think of it as a spotlight) and another LED(located in the post guard blinks to alert the guard). In addition to this, the LCD will also display "Danger in room1". Keep in mind that the LDR is not related at all to the PIR sensor, just one LED located inside the room with the PIR.
So i did 2 void loops(void Pirsensor & void LDR) since the PIR is independent of the LDR. My problem with the coding is, when the motion is sensed(HIGH), yes, it works, the "spotlight" stays on,the LED in the post guard blinks, and the LCD displays, but when the loop ends, all the above goes off. Eventhough the motion is still high, all the above still goes off after the loop ends, and starts over. So what i want to know is,how do i make all the above stay on, while motion is still high?
I have attached my codings, and i know they're pretty basic but im still new, and hope you will help me out. Pls focus on the PIR+LCD part. Thank You
proje.txt (1.26 KB)