I purchased a RCWL-1601 - which is supposed to be a 3.3v version of the HC-SR04 and compatible with the HC-SR04 library - which I am trying to use with my Itsy M0.
I've wired it up as follows:
(as no resistors are needed to change voltage down from 5.5?)
And my code:
Code: Select all
import time
import board
import adafruit_hcsr04
sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.RX, echo_pin=board.TX)
while True:
try:
print((sonar.distance,))
except RuntimeError:
print("Retrying!")
time.sleep(0.1)
Code: Select all
(17.1204,)
(0.0,)
(0.0,)
(0.0,)
(0.0,)
(17.1204,)
(17.1204,)
(17.1204,)
What am I doing wrong? Thanks for any help.