Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buildhat-0.5.5.tar.gz (146.9 kB view details)

Uploaded Source

Built Distribution

buildhat-0.5.5-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file buildhat-0.5.5.tar.gz.

File metadata

  • Download URL: buildhat-0.5.5.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

Hashes for buildhat-0.5.5.tar.gz
Algorithm Hash digest
SHA256 a6fdb9615ebcf85b77eee01e6715fc47796c1a7c81de968b9b3b6a4f5634626e
MD5 be447de3256d2f88077fd8a63c9e2cb3
BLAKE2b-256 a43a8bfa6874a0615c93e3e6012ce58080529fdb03b424c1c471e70712ea21ba

See more details on using hashes here.

File details

Details for the file buildhat-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: buildhat-0.5.5-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

Hashes for buildhat-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 71734ed8e0e627973a54ecf329f07f398a4714cc7358b07b58464f9962a74ecb
MD5 91d958e6ea5fec78b98d7a0e8f5e9931
BLAKE2b-256 f8bdc0f9a5828d59ced28ee50da1e2903e4ff5a2a34d11a22a535b0924baa81a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page