We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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() `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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()
if d <= 3 and d <= 10
led.on() (True)
else:
led.off()
`
The text was updated successfully, but these errors were encountered: