I am experimenting, playing, with a raspberry zero and a hc-sr04 sensor.
I came across the learning resource
https://www.raspberrypi.org/learning/ph ... /distance/
and tried the code there.
I was unhappy with the results (and the example code given in the article).
The output of the measuring is invariably 1. [print(ultrasonic.distance)] I suspect the default value.
When I wave my hands above the sensor, the output does not change.
There is something wrong and it is not the Pi or the sensor. Because when I change back to earlier code all functions fine.
The only change I made to the example code is
Code: Select all
ultrasonic = DistanceSensor(echo=24, trigger=23)
http://gpiozero.readthedocs.io/en/stabl ... nce-sensor
does not work.
Any advice? Please.