Stretch vs. HC-SR04 - Raspberry Pi Forums


hi all,

today tested hc-sr04 distance sensor code gpiozero documentation


gpiozero import distancesensor
time import sleep

sensor = distancesensor(echo=22, trigger=17, queue_len=3)
while true:
print('distance: ', sensor.distance * 100)
sleep(1)


on rpi3 running on strech. (i changed pins convenience , queue_len because default value "30" had wait quite long time before first results printed.)

unfortunately sensor.distance continuously returned "1" . funny bit: after couple of hours of fiddling replaced sd card unused 1 jessie system. sensor worked fine. stretch - sensor.distance "1".

ideas apart "just use jessie"?

(i'm happy provide detailed information system - if tell me need know. :) )

from previous posts think find same issue jessie. method use hc-sr04 see code @ bottom of page wireing instructions @ top of page https://www.modmypi.com/blog/hc-sr04-ul ... spberry-pi


raspberrypi



Comments

Popular posts from this blog

Help with Missing Filename Error?

more info - Joomla! Forum - community, help and support

Using phone battery to power a plane.