HC-SR04_Python-library
HC-SR04_Python-library for PyPi
https://pypi.org/project/HC-SR04
Getting Started
Prerequisites
- Arduino board
- HC_SR04 sensors
-
porting arduino code to arduino board
Installation
$ pip install HC-SR04
Usage
Import
from HC_SR04 import HC_SR04 as hc
from HC_SR04 import HC_SR04_fair as hc_fair
tmp = hc()
tmp_fair = hc_fair()
import HC_SR04
tmp = HC_SR04.HC_SR04()
tmp_fair = HC_SR04.HC_SR04_fair()
from HC_SR04 import HC_SR04_fair
from HC_SR04 import HC_SR04
tmp = HC_SR04()
tmp_fair = HC_SR04_fair()
Examples
from HC_SR04 import HC_SR04 as hc # single board with HC_SR04(1 to many)
my_arduino = hc(channel = 3, open=True) # if open is set True then open Serial connection, default open is False
print(my_arduino.get())
from HC_SR04 import HC_SR04_fair # single board with HC_SR04(1 to many)
my_arduino_fair = HC_SR04_fair(channel = 3, port_left = '/dev/ttyUSB3', port_right = '/dev/ttyUSB4')
# call open_serial() before using .get* method()
# or set open = True, e.g., my_arduino_fair = HC_SR04_fair(channel = 3, open = True)
my_arduino_fair.open_serial()
print(my_arduino_fair.get())
print(my_arduino_fair.get_leftside())
print(my_arduino_fair.get_left_sensors())
# print out status of instance
my_arduino_fair.test()
# switch left <-> right
my_arduino.switch()
# print out status of instance
my_arduino_fair.test()
my_arduino_fair.close_serial()
Dev
Build
$ python3 -m build
Local test
$ pip install -e .
Build and Local test
$ python3 -m build && pip install -e . && python
Release
$ python -m twine upload dist/*
Metadata
Release files for HC-SR04 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| HC_SR04-0.3.1.tar.gz | 3.7 kB | Without provenance | Details for HC_SR04-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| HC_SR04-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for HC_SR04-0.3.1-py3-none-any.whl |
Total release size: 20.3 kB
Release files / HC_SR04-0.3.1.tar.gz
| Download URL | HC_SR04-0.3.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b901f0376f7631422dbfabdbe0818de08af3f6efb4f8509f7db63820876ca07f
|
|
BLAKE2b-256 checksum How to use checksums |
9492e4ce16d09442a3a385d5e3fcb57b8775d6af8a3f356c23283e891c4b7717
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
|
Release files / HC_SR04-0.3.1-py3-none-any.whl
| Download URL | HC_SR04-0.3.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6aad6b4a465b797fa92fb5dc3f9be5dde2ce7d7fb5a66b5a3d4e3c5a8865f4e
|
|
BLAKE2b-256 checksum How to use checksums |
cfbe6d33d95461d9f7cb0c2e416288d1fa640cde9f4674c58b3f6269d10372d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
|
Security for HC-SR04 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.