Skip to content

I don't know what to do here #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Rafoni-py opened this issue Apr 4, 2025 · 0 comments
Open

I don't know what to do here #344

Rafoni-py opened this issue Apr 4, 2025 · 0 comments

Comments

@Rafoni-py
Copy link

I'm using this code to make an ultrasound measuring tape and a led need to turn on if the distance is equal or less than 10 cm but it just don't work

`from machine import Pin, time_pulse_us
from time import sleep_ms, sleep_us

trg = Pin(13, Pin.OUT)
ech = Pin(23, Pin.IN)
led = Pin(26, Pin.OUT, 1)
var1 = time_pulse_us(ech, 1, 20000)

while True:
trg.off()
sleep_us(5)
trg.on()
sleep_us(10)
trg.off()

t = time_pulse_us(ech, 1, 20000)
d = t / 58.8
print (d)
sleep_ms(2000)

if d <= 3 and d <= 10
led.on() (True)
else:
led.off()
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant