Skip to main content

I/O Communication Library

Project description

ahio

ahio is a communication library whose goal is to abstract the interfacing with various I/O hardwares, so that changing hardware becomes possible with minimum code modification. It's desired that an application that already works with an I/O hardware will only need pin remapping and possibly initial setup change to work with another hardware, not entire code rewrite.

It works with drivers, which are installed in the ahio.drivers package. Every driver must implement the API described in the ahio.abstract_driver package. If you plan to use this library or develop a driver, read the documentation there.

Installation

Simplest way is to use pip: pip3 install ahio Alternatively you can checkout this repository and run python3 setup.py install

Basic usage

# Import the package:
import ahio

# You can see what drivers are available in this platform by calling
print(ahio.list_available_drivers())

# Instantiate the desired driver
with ahio.new_driver('Arduino') as arduino:
  # The driver can have a driver-specific setup function. Call it as/if needed.
  arduino.setup('/dev/tty.usbmodem1421')

  # Map the pins. From now on, when you use 1 in the API, it will have effects
  # on pin D3 in the Arduino. If you change hardware in the future, just change
  # the mapping.
  arduino.map_pin(1, arduino.Pins.D3)
  arduino.map_pin(2, arduino.Pins.D13)
  arduino.map_pin(3, arduino.Pins.A1)

  # Change a pin direction (Input or Output)
  arduino.set_pin_direction([1, 2], ahio.Direction.Output)
  arduino.set_pin_direction(3, ahio.Direction.Input)

  # Set the output of a pin
  arduino.write([1, 2], ahio.LogicValue.High)
  arduino.write(1, 0.4, pwm=True)

  # Read the input of a pin
  print(arduino.read(3))

Documentation

Documentation is hosted at GitHub

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

ahio-1.0.35.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ahio-1.0.35-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file ahio-1.0.35.tar.gz.

File metadata

  • Download URL: ahio-1.0.35.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ahio-1.0.35.tar.gz
Algorithm Hash digest
SHA256 7141fcf0fdae7694253ea72cf49db27bc9352a822a3be563f99b33d530bc1972
MD5 e5ef578cdea7117a23fe4d0dccd0ca84
BLAKE2b-256 9d4e77650524c5cf5ff1a37ab7768c3e6b71e03be9336a5aec0b338e9ab77b6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahio-1.0.35.tar.gz:

Publisher: wheels.yml on acristoffers/ahio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ahio-1.0.35-py3-none-any.whl.

File metadata

  • Download URL: ahio-1.0.35-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ahio-1.0.35-py3-none-any.whl
Algorithm Hash digest
SHA256 0703c88857a6b8a8b924d96df9653a289f9f09af77efd2fa943820d0059d0cff
MD5 a44dae35337b2bb829d92d2ce65e0e4f
BLAKE2b-256 e87259c30af3e0415b0cc7f93403b50f9fffa5a33edebc455d11e0e4c2273d41

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahio-1.0.35-py3-none-any.whl:

Publisher: wheels.yml on acristoffers/ahio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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