ahio


Nameahio JSON
Version 1.0.33 PyPI version JSON
download
home_pagehttps://github.com/acristoffers/ahio
SummaryI/O Communication Library
upload_time2024-01-16 07:49:12
maintainer
docs_urlNone
authorÁlan Crístoffer
requires_python>=3.8,<3.12
licenseMIT
keywords data acquisition i/o hardware communication
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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
-----------

```python
# 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](https://acristoffers.github.io/ahio)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/acristoffers/ahio",
    "name": "ahio",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.12",
    "maintainer_email": "",
    "keywords": "data acquisition,I/O,hardware communication",
    "author": "\u00c1lan Cr\u00edstoffer",
    "author_email": "acristoffers@startmail.com",
    "download_url": "https://files.pythonhosted.org/packages/07/c1/126968c35dc2457e1932f4e65410c4ad1adb65bb022618650f409270d2a7/ahio-1.0.33.tar.gz",
    "platform": null,
    "description": "ahio\n====\n\nahio is a communication library whose goal\nis to abstract the interfacing with various I/O hardwares, so that changing\nhardware becomes possible with minimum code modification. It's desired that\nan application that already works with an I/O hardware will only need pin\nremapping and possibly initial setup change to work with another hardware, not\nentire code rewrite.\n\nIt works with drivers, which are installed in the `ahio.drivers` package. Every\ndriver must implement the API described in the `ahio.abstract_driver` package.\nIf you plan to use this library or develop a driver, read the documentation\nthere.\n\n\nInstallation\n------------\n\nSimplest way is to use pip: `pip3 install ahio`\nAlternatively you can checkout this repository and run\n`python3 setup.py install`\n\n\nBasic usage\n-----------\n\n```python\n# Import the package:\nimport ahio\n\n# You can see what drivers are available in this platform by calling\nprint(ahio.list_available_drivers())\n\n# Instantiate the desired driver\nwith ahio.new_driver('Arduino') as arduino:\n  # The driver can have a driver-specific setup function. Call it as/if needed.\n  arduino.setup('/dev/tty.usbmodem1421')\n\n  # Map the pins. From now on, when you use 1 in the API, it will have effects\n  # on pin D3 in the Arduino. If you change hardware in the future, just change\n  # the mapping.\n  arduino.map_pin(1, arduino.Pins.D3)\n  arduino.map_pin(2, arduino.Pins.D13)\n  arduino.map_pin(3, arduino.Pins.A1)\n\n  # Change a pin direction (Input or Output)\n  arduino.set_pin_direction([1, 2], ahio.Direction.Output)\n  arduino.set_pin_direction(3, ahio.Direction.Input)\n\n  # Set the output of a pin\n  arduino.write([1, 2], ahio.LogicValue.High)\n  arduino.write(1, 0.4, pwm=True)\n\n  # Read the input of a pin\n  print(arduino.read(3))\n```\n\nDocumentation\n-------------\n\nDocumentation is hosted at [GitHub](https://acristoffers.github.io/ahio)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "I/O Communication Library",
    "version": "1.0.33",
    "project_urls": {
        "Homepage": "https://github.com/acristoffers/ahio",
        "Repository": "https://github.com/acristoffers/ahio"
    },
    "split_keywords": [
        "data acquisition",
        "i/o",
        "hardware communication"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d27929a973ae6d5a7c849822625f94a70b7fa9a292c893f7ae7bbafe0d1478d6",
                "md5": "6010df87701f440790228b314dc62e10",
                "sha256": "7f8d36a6adf07f95747490491c41bba53c0f48c5c41082a52a4b611a5329b041"
            },
            "downloads": -1,
            "filename": "ahio-1.0.33-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6010df87701f440790228b314dc62e10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.12",
            "size": 26949,
            "upload_time": "2024-01-16T07:49:10",
            "upload_time_iso_8601": "2024-01-16T07:49:10.082674Z",
            "url": "https://files.pythonhosted.org/packages/d2/79/29a973ae6d5a7c849822625f94a70b7fa9a292c893f7ae7bbafe0d1478d6/ahio-1.0.33-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07c1126968c35dc2457e1932f4e65410c4ad1adb65bb022618650f409270d2a7",
                "md5": "27fd60a4fcac008d8b25eac3604c4fef",
                "sha256": "bb6073e111837b0f8455c40eb4f0fc9ca154288b80f6e0da3847588a663364d4"
            },
            "downloads": -1,
            "filename": "ahio-1.0.33.tar.gz",
            "has_sig": false,
            "md5_digest": "27fd60a4fcac008d8b25eac3604c4fef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.12",
            "size": 16257,
            "upload_time": "2024-01-16T07:49:12",
            "upload_time_iso_8601": "2024-01-16T07:49:12.520005Z",
            "url": "https://files.pythonhosted.org/packages/07/c1/126968c35dc2457e1932f4e65410c4ad1adb65bb022618650f409270d2a7/ahio-1.0.33.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-16 07:49:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "acristoffers",
    "github_project": "ahio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ahio"
}
        
Elapsed time: 0.23946s