Thank you so much for your suggestion, I used PyPi because the libraries can be installed directly from Thonny IDE. It is beginner-friendly way. I am going to update the post to add the PyPi link and Github linkGood effort.
If you want people to find your code, at least include the text of your package. Better still, include a link with the text: DIYables-MicroPython-Ultrasonic-Sensor
pypi isn't the best place for providing MicroPython libraries, as you can't browse and download individual files, and only Thonny can see it. github or similar would be better. That way, the official mpremote tool can be used to install libraries.
There are some MicroPython boards which are quite strongly 5 V averse, so you need that divider.
Awesome MicroPython shows us that there's already a HC-SR04 library: rsc1975/micropython-hcsr04: Micropython driver for ultrasonic sensor HC-SR04. It uses machine.time_pulse_us() to time the echo, which might be a little more accurate than looping. It also recommends dropping the sensor output through a resistor.
If the library contain code for LCDs, it's very well hidden.
Statistics: Posted by DIYables — Fri Sep 13, 2024 1:02 am