print("progra:To make the gate auto open when a car aproach")
print("by:Faiz")
print("Dates:25/4/2024")
#import library
import servo_library
from machine import Pin, PWM
from utime import sleep
#Pin declaration
servo_pin = Pin(5, Pin.OUT)
PIR_pin = (13,pin.IN)
#parameter declaration
#Create an object name
toll_gate = servo_library.Servo(pin=servo_pin)
#main program
while True:
motion_status = PIR_pin.value() # .value --> digital value (1 or 2)
toll_gate.move(angle=90)
sleep(3)
toll_gate.move(angle=0)
sleep(8)
Loading
esp32-devkit-v1
esp32-devkit-v1