@@ -0,0 +1,1771 @@
+# Import Python header files%0Aimport RPi.GPIO as GPIO%0Aimport time%0A%0A# Set the GPIO naming convention%0AGPIO.setmode(GPIO.BCM)%0AGPIO.setwarnings(False)%0A%0APinPIR = 17%0APinRedLED = 18%0APinBlueLED = 24%0APinBuzzer = 22%0A%0Aprint %22PIR Module Test (CTRL-C to exit)%22%0A%0A# Set pins as input/output%0AGPIO.setup(PinPIR, GPIO.IN)%0AGPIO.setup(PinRedLED, GPIO.OUT)%0AGPIO.setup(PinBlueLED, GPIO.OUT)%0AGPIO.setup(PinBuzzer, GPIO.OUT)%0A%0A# Variables to hold the current and last states%0ACurrent_State  = 0%0APrevious_State = 0%0A%0Atry:%0A    print %22Waiting for PIR to settle ...%22%0A    # Loop until PIR output is 0%0A    while GPIO.input(PinPIR)==1:%0A        Current_State    = 0%0A%0A    print %22Ready%22%0A    # Loop until users quits with CTRL-C%0A    while True :%0A        # Read PIR state%0A        Current_State = GPIO.input(PinPIR)%0A%0A        if Current_State==1 and Previous_State==0:%0A            # PIR is triggered%0A            print %22    Motion detected!%22%0A            # Flash lights and sound buzzer three times%0A            for x in range(0,3):%0A                GPIO.output(PinBuzzer, GPIO.HIGH)%0A                GPIO.output(PinRedLED, GPIO.HIGH)%0A                time.sleep(0.2)%0A                GPIO.output(PinRedLED, GPIO.LOW)%0A                GPIO.output(PinBlueLED, GPIO.HIGH)%0A                time.sleep(0.2)%0A                GPIO.output(PinBlueLED, GPIO.LOW)%0A                GPIO.output(PinBuzzer, GPIO.LOW)%0A                time.sleep(0.2)%0A            %0A            # Record previous state%0A            Previous_State=1%0A%0A        elif Current_State==0 and Previous_State==1:%0A            # PIR has returned to ready state%0A            print %22    Ready%22%0A            Previous_State=0%0A%0A        # Wait for 10 milliseconds%0A        time.sleep(0.01)%0A%0Aexcept KeyboardInterrupt:%0A    print %22Quit%22 %0A    # Reset GPIO settings%0A    GPIO.cleanup()%0A

Create 6-Alarm.py