to gather all parking space data it's need ultrasonic sensors hc-sr04 in every parking space. so if there are 20 parking space it needs 20 ultrasonic sensors and sent all the data to wemos d1 mini.
park your car easier
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
to gather all parking space data it's need ultrasonic sensors hc-sr04 in every parking space. so if there are 20 parking space it needs 20 ultrasonic sensors and sent all the data to wemos d1 mini.
from machine import Pin,PWM
import time
trig = 15
echo = 13
led = 4
echo = Pin(echo, Pin.IN)
led = Pin(led, Pin.OUT)
trig = Pin(trig, Pin.OUT)
servo = PWM(Pin(2), freq=50, duty=77)
trig.off()
time.sleep_ms(2)
trig.on()
time.sleep_ms(10)
trig.off()
def get_distance(unit="cm"):
trig.on()
time.sleep_ms(10)
trig.off()
while echo.value() == 0:
pass
start = time.ticks_us()
while echo.value() == 1:
pass
stop = time.ticks_us()
d = (stop - start)/58
distance = round(d,2)
if unit == "mm":
factor = 10
elif unit == "cm":
factor = 1
elif unit == "m":
factor = 0.1
return distance*factor
def limit(value):
x=int(get_distance())
if x < float(value):
led.on()
print('limit is reached')
else:
led.off()
print('distance is {} cm'.format(x))
print('limit is {} cm'.format(value))
while True:
limit(1000)
time.sleep_ms(1)
if x < 5 :
servo.duty(30)
time.sleep_ms(1)
servo.duty(122)
from machine import Pin, PWM
from time import sleep
servo = PWM(Pin(2), freq=50, duty=77)
servo.duty(30)
sleep(.5)
servo.duty(122)
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More
Cool, I like it. You know parking is really the pain in the ass in big city.
More details plz:)