Open cletusw opened 4 years ago
This has been suggested before, though I don't see an issue for it. Not sure how easy it would be, with how gpiozero works with pins, and I'd fear it could throw the timing out. Worth looking into.
@waveform80 what do you think?
Purpose of change: Support HC-SR04 ultrasonic sensors where trigger and echo are connected to the same pin
Where would this change be made: DistanceSensor class
Short description of change: The Picon Zero is a utility HAT with lots of functionality, one of which is a 4 pin header that allows directly inserting an HC-SR04 sensor and it provides the needed 5v/3v voltage divider. To reduce potential conflicts with other HATs, though, it uses a single GPIO pin, 20, for trigger and echo.
See the example code they provide (which uses BOARD numbering so 38 means GPIO 20), which shows how they toggle that pin back and forth from input to output.
If gpiozero could support this that would be amazing!
Please provide example usage of gpiozero with your suggested change: