adafruit / Adafruit_CircuitPython_HCSR04

CircuitPython library for controlling HC-SR04 ultrasonic range sensors
MIT License
9 stars 22 forks source link

Update to the correct distance call #20

Closed dannystaple closed 4 years ago

dannystaple commented 4 years ago

It looks like the distance property replaces thedist_cm()` function. Also gave a hint here that the board pin objects are needed, and not just integers.

FoamyGuy commented 4 years ago

Thank you @dannystaple. There is a minor issue with the docs building on this PR currently. I've submitted a PR on your branch that should fix it. I think if you merge my PR it should automatically show up here as well and fix the docs building when it retries the CI actions.

dannystaple commented 4 years ago

Looks like putting in the import, I missed the blank line - RST doesn't like that. The language hints can't hurt. More fool me for not trying the Sphinx build locally - done so now and it looks good.

FoamyGuy commented 4 years ago

@dannystaple Testing this out now on a HC0SR04 sensor I've hit a few more snags. The code in the readme is using sleep() but not importing it, so we'll need to add that import.

Also it seems like there is some sort of RuntimeError that needs to be caught and then retried after in order for the sensor to work (at least for my sensor with Itsy Bitsy M0). Though I also realized from this learn guide page: https://learn.adafruit.com/ultrasonic-sonar-distance-sensors/python-circuitpython that it is required to use some resistors to hook this up and I didn't do that the first time, so perhaps that is part of my problem.

Can you go ahead and copy the entire contents hcsr04_simpletest.py into the readme please. It looks like the example was updated at some point to address these things, but the readme never was.

Sorry for all of the changes, I didn't notice some of these issues until putting the circuit together. I really appreciate you working on this to get the readme example back to functional.

I will try to get some resistors dug up and get my circuit set up to properly test this out all the way a bit later on today.

kattni commented 4 years ago

@dannystaple Have you had a chance to follow up on FoamyGuy's latest comment?

dannystaple commented 4 years ago

Apologies no - I have a tight deadline to hit and have been flat out. I may return to this at some point in the future.

On 17 Aug 2020, at 21:46, Kattni notifications@github.com wrote:

@dannystaple https://github.com/dannystaple Have you had a chance to follow up on FoamyGuy's latest comment?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_HCSR04/pull/20#issuecomment-675105728, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIG27YOANQCEUQTGZ6WYDSBGJKHANCNFSM4OCBI32Q.

kattni commented 4 years ago

@dannystaple Thank you for letting me know. I will see if FoamyGuy can finish it up.

kattni commented 4 years ago

@FoamyGuy The original author is unavailable at the moment. Would you mind finishing up this PR as per your suggestions? Thanks!