Make a new directory called project called motion_alarm, or similar. Inside create a new Python script called alarm.py or motion_alarm.py.
In that file, copy the code from the previous challenge, since you will keep the LED and motion detection.
Keep the same wiring as the previous challenge.
Define new functions to handle each process, for example:
get_time()
play_sound()
send_email()
log_incident()
Call these when the motion sensor is active and LED is turned on.