PIR motion detection

bugs cleared.