from machine import Pin
import servo
Pir_sensor = Pin(13, Pin.IN)
Led = Pin(14, Pin.OUT)
SM=servo.Servo(Pin(18))
while True:
if Pir_sensor.value() == True:
Led.value(1)
SM.write_angle(180)
print("Motion Detected and Door Opened")
else:
Led.value(0)
print("Motion not Detected and Door Closed")
SM.write_angle(0)