Project: Alerting System with a Passive Infrared Sensor

Hi!
I am Unique :slight_smile: ,
and I'm facing a huge problem and I need your help on how to do the coding correctly,

So...
Starting from the beginning (so that you could understand), I'm an intern working on a project where I would need an alarming system for my workplace.

How this alarm system works is that if someone is in the area for too long (for more than 5 seconds)
The alarm will sound so that they will know they need to do something.
And if they already left the area by (let's say) 3 seconds,
then the alarm will go back to its original state where it seeks for detection.

If not, the alarm will still sound.
(note that it takes them only 5 seconds till the alarm goes off)
and also, please note that I have used an LED instead of the Piezo buzzer because this is just my first day of coding (yes, surprisingly I've learnt this much haha), will attach a flow chart of how this system works and the coding)

Thank You So Much For Your Generous help and also for reading this awful lot message haha.

ALARM_SYSTEM..ino (807 Bytes)

WARNING SYSTEM FLOWCHART.pdf (204 KB)

Homework...??

Nope, more like a project that I'm actually interested to do. :sweat_smile: