added code for PIR motion sensor