Build HAT Python library
Project description
Welcome
This Python module allows you to utilise the Raspberry Pi Build HAT. It includes detailed documentation -- see below for how to generate and read it.
Install
If using asdf:
asdf install
Then:
pip3 install . --user
Documentation
Documentation can be viewed at: https://buildhat.readthedocs.io
Instructions for regenerating the documentation can be found in
docs/README.md
. Briefly, assuming you have the appropriate python
modules installed:
$ (cd docs; make html)
will rebuild the documentation. The doc tree starts at docs/build/html/index.html
Usage
See the detailed documentation for the Python objects available.
import time
from signal import pause
from buildhat import Motor
motor = Motor('A')
motor.set_default_speed(30)
print("Position", motor.get_aposition())
def handle_motor(speed, pos, apos):
print("Motor", speed, pos, apos)
motor.when_rotated = handle_motor
print("Run for degrees")
motor.run_for_degrees(360)
print("Run for seconds")
motor.run_for_seconds(5)
print("Run for rotations")
motor.run_for_rotations(2)
print("Start motor")
motor.start()
time.sleep(3)
print("Stop motor")
motor.stop()
pause()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file buildhat-0.5.4.tar.gz
.
File metadata
- Download URL: buildhat-0.5.4.tar.gz
- Upload date:
- Size: 146.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb6ceb9ccb6274b96b0c4a49a35dbfdb023ccec0fee177517d5935b28d8628a5 |
|
MD5 | e80342ad32d372dfb51e8275c1b10192 |
|
BLAKE2b-256 | 657e27ce686f22379695f4f421f20ba32ed2fdd909d3c38ef655fc546ced1f0f |
File details
Details for the file buildhat-0.5.4-py3-none-any.whl
.
File metadata
- Download URL: buildhat-0.5.4-py3-none-any.whl
- Upload date:
- Size: 49.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1edc36e05db46cf8a61ef93d5324655043050d8529e5c802c1a2a41286a7de6b |
|
MD5 | 162a7ac06e3d00fdfd0298f2c2e31a79 |
|
BLAKE2b-256 | c2638f337be794e96a5deb6b463c37d0995473ffb3694e5113567c0ca5851bc8 |