on-internet
← Community

How to setup ultrasonic sensor to return values after 1 second

Stack Overflow ·

I am a new python and raspberry Pi user, I have run this regular code for ultrasonic sensor, the problem with it is that I have connected it to a system where it has continuous 5v input so it has no stop time --> resulting impossibility of stable distance measurement, I understood that I have to set a delay with time.sleep(1) somewhere to make it run for only 1 second for each measurement so it will get stable. My question is: where do I have to insert the delay? Is that answer right? Code: import RPi.GPIO as GPIO import time #GPIO Mode (BOARD / BCM) GPIO.setmode(GPIO.BCM) GPIO.setwarnings(Fal

Comments

Sign in or sign up to comment and upvote.

No comments yet.