Skip to content

Does not work well without pulseio #28

Open
@ladyada

Description

@ladyada

from
https://forums.adafruit.com/viewtopic.php?f=62&t=190920&p=924044#p924041

for itsybitsy m0 and gemma m0


Your adafruit_hcsr04.mpy does not work with CircuitPython 7.x -- To get the sensor to work, I had to install:

adafruit-circuitpython-gemma_m0-en_US-6.3.0.uf2

and then use:

adafruit-circuitpython-bundle-6.x-mpy-20211213.zip

After downgrading the Gemma to these version - the sensor now works perfect.

I tried multiple versions of 7.X - none worked, it was only when I downgraded back to 6.3.0 - that the sensor started working.


### Code/REPL

```python
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)

Behavior

(17.1204,)
(0.0,)
(0.0,)
(0.0,)
(0.0,)
(17.1204,)
(17.1204,)
(17.1204,)

Which is just random - no relation to distance of anything in front of the sensor. It's always just jumping between 0.0 and 17.xx

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions