{ "info": { "author": "vash", "author_email": "vash.3d@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries" ], "description": "# Pigpio Encoder\n\n###### Version: 0.2.0\n\n\n#### Python module for the KY040 rotary encoder.\nThis module has been developed for quickly interface a rotary encoder with Raspberry Pi.\nIt's based on the [pigpio library](http://abyz.me.uk/rpi/pigpio/python.html) (cause it proved to be faster than rpi.GPIO or gpiozero libraries) so you need to install pigpio library and run pigpio daemon before starting your script.\n\n## Features\n- Easy to setup callback functions for the Rotary Encoder and the Switch.\n- The Rotary Encoder has customizable min and max values (default 0-100).\n- The Rotary Encoder increase/decrease value is customizable (default 1).\n- The Switch can be activated or not.\n- The Switch can have two different functions for short press or long press.\n- Both Rotary and Switch have a customizable debounce value (default 300ms)\n\n## Installation\n- Install the pigpio library *(check [pigpio documentation](http://abyz.me.uk/rpi/pigpio/download.html) for alternative installation method)*\n - `sudo apt-get update`\n - `sudo apt-get install pigpio python-pigpio python3-pigpio`\n- Install the pigpio_encoder library\n - `pip install pigpio_encoder` (consider add --user option)\n- start pigpio daemon\n - `sudo pigpiod`\n\n## How to use\n- import the module\n ```python\n from pigpio_encoder import pigpio_encoder\n ```\n- create a callback function for the Rotary Encoder.\n > You must pass a positional argument to retrieve the counter value.\n\n ```python\n def rotary_callback(counter):\n # some action with counter...\n ```\n- create callbacks functions for the Switch\n > If you intend to use the switch you must create at least the \"short press\" callback. The \"long press\" callback is necessary if you want to use that feature.\n\n ```python\n def sw_short_callback():\n # some action...\n ```\n ```python\n def sw_long_callback():\n # some action...\n ```\n- create the rotary object\n > here you setup the pin number as keyword argument. If you don't pass the switch parameter the switch won't be activated. You must use BCM numbering.\n\n ```python\n my_rotary = pigpio_encoder.Rotary(clk=pin, dt=pin, sw=pin)\n ```\n- setup the rotary encoder\n > here you can setup min and max values for the encoder, the increase/decrease value, a debouce value (default 300ms) and the callback function.\n\n ```python\n my_rotary.setup_rotary(min=min_value, max=max__value, scale=scale_value, debounce=debounce_value, rotary_callback=rotary_callback)\n ```\n- setup the switch\n > if you have specified the switch pin when creating the encoder object, here you can setup the debounce value, the long press option and the callbacks.\n\n ```python\n my_rotary.setup_switch(debounce=debounce_value, long_press=True, sw_short_callback=sw_short_callback, sw_long_callback=sw_long_callback)\n ```\n\n- start the listener\n ```python\n my_rotary.watch()\n ```\n\n___\n#### Basic example using default values\n```python\nfrom pigpio_encoder import pigpio_encoder\n\ndef rotary_callback(counter):\n print(\"Counter value: \", counter)\n\ndef sw_short():\n print(\"Switch pressed\")\n\nmy_rotary = pigpio_encoder.Rotary(clk=27, dt=22, sw=17)\nmy_rotary.setup_rotary(rotary_callback=rotary_callback)\nmy_rotary.setup_switch(sw_short_callback=sw_short)\n\nmy_rotary.watch()\n\n```\n___\n\n#### Example using all the Features\n```python\nfrom pigpio_encoder import pigpio_encoder\n\ndef rotary_callback(counter):\n print(\"Counter value: \", counter)\n\ndef sw_short():\n print(\"Switch short press\")\n\ndef sw_long():\n print(\"Switch long press\")\n\nmy_rotary = pigpio_encoder.Rotary(clk=27, dt=22, sw=17)\nmy_rotary.setup_rotary(min=10, max=300, scale=5, debounce=200, rotary_callback=rotary_callback)\nmy_rotary.setup_switch(debounce=200, long_press=True, sw_short_callback=sw_short, sw_long_callback=sw_long)\n\nmy_rotary.watch()\n\n```\n\n___\n\n## Thanks to...\n- [joan2937](https://github.com/joan2937) for the awesome [pigpio library](https://github.com/joan2937/pigpio)\n- [Raphael Yancey](https://github.com/raphaelyancey) for inspiring me this library with his [similar project](https://github.com/raphaelyancey/pyKY040)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vash3d/pigpio_encoder", "keywords": "rotary encoder switch ky040 gpio raspberry", "license": "GNU GPLv3", "maintainer": "", "maintainer_email": "", "name": "pigpio-encoder", "package_url": "https://pypi.org/project/pigpio-encoder/", "platform": "", "project_url": "https://pypi.org/project/pigpio-encoder/", "project_urls": { "Homepage": "https://github.com/vash3d/pigpio_encoder" }, "release_url": "https://pypi.org/project/pigpio-encoder/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Python module for for quickly interface a KY040 rotary encoder with Raspberry Pi.", "version": "0.2.1" }, "last_serial": 4780361, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f5e53afd3120e436edb457353c11b2c6", "sha256": "ceab25a5f7dbbf6f00466d312cabb2fd506e3622c2e903c007583b448277a9b9" }, "downloads": -1, "filename": "pigpio_encoder-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f5e53afd3120e436edb457353c11b2c6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16157, "upload_time": "2019-01-04T14:41:45", "url": "https://files.pythonhosted.org/packages/1d/37/8aea4be0e90c06abc1a1472f2eb627a75e842e9151bd9090378e88aabd8e/pigpio_encoder-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "54f7a81468bbf0fca32902cd859cc5cf", "sha256": "4e32878232e33f91a3c8369ad1d8911f8e998f9f42987ffe782f4589d9542016" }, "downloads": -1, "filename": "pigpio_encoder-0.1.0.tar.gz", "has_sig": false, "md5_digest": "54f7a81468bbf0fca32902cd859cc5cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3919, "upload_time": "2019-01-04T14:41:47", "url": "https://files.pythonhosted.org/packages/92/b6/e472b8c1db26d952fe64e69f2a59224eb7c300bc0a65a1590966eea45660/pigpio_encoder-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d532d40eb8c47c4375e369f338bbc384", "sha256": "b70532ee6f89bb88038bce5a5c8a3c04e256aa1a20f0cf824bec4d0d64e2bd2b" }, "downloads": -1, "filename": "pigpio_encoder-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d532d40eb8c47c4375e369f338bbc384", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16259, "upload_time": "2019-01-31T00:19:12", "url": "https://files.pythonhosted.org/packages/9a/1a/894ed0243715e27e2a818f3f797ee6257f5bf58e8b963e5cc551d1b6597a/pigpio_encoder-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e8d45d7373d93f33f362b3e74654836f", "sha256": "ac161ad192bd9931b23d3a20a530bc5b3a7272df8c3a5a8ded8c12d3e11181f0" }, "downloads": -1, "filename": "pigpio_encoder-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e8d45d7373d93f33f362b3e74654836f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4003, "upload_time": "2019-01-31T00:19:14", "url": "https://files.pythonhosted.org/packages/8b/af/eb7b9566c18137972b8f3625a709a49bc71b79eded1b17ed2c7c8f1d1737/pigpio_encoder-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "0e637654016391ecd7321eea3d48a4d4", "sha256": "74208e7ee111f6fcc2fe0b6963024d40f1862ebfdeb236b548b1e70722077c24" }, "downloads": -1, "filename": "pigpio_encoder-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e637654016391ecd7321eea3d48a4d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16253, "upload_time": "2019-02-05T01:56:32", "url": "https://files.pythonhosted.org/packages/81/a5/fd126e9ae6ad9c179810f37e0d587096dadfc8b4e8f8300835ebab85685d/pigpio_encoder-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cea9382690ece47fde8b1d7ab48c96cb", "sha256": "f5c50cc98146fa57bdab5a0b756833d6c9db2bcea8123b916b0c2baadfdc6f12" }, "downloads": -1, "filename": "pigpio_encoder-0.2.1.tar.gz", "has_sig": false, "md5_digest": "cea9382690ece47fde8b1d7ab48c96cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3989, "upload_time": "2019-02-05T01:56:33", "url": "https://files.pythonhosted.org/packages/b2/3e/c2388c1967296df703ecbbc9805a3a620ec72ad2f88f1c545aef5c00cd04/pigpio_encoder-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e637654016391ecd7321eea3d48a4d4", "sha256": "74208e7ee111f6fcc2fe0b6963024d40f1862ebfdeb236b548b1e70722077c24" }, "downloads": -1, "filename": "pigpio_encoder-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e637654016391ecd7321eea3d48a4d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16253, "upload_time": "2019-02-05T01:56:32", "url": "https://files.pythonhosted.org/packages/81/a5/fd126e9ae6ad9c179810f37e0d587096dadfc8b4e8f8300835ebab85685d/pigpio_encoder-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cea9382690ece47fde8b1d7ab48c96cb", "sha256": "f5c50cc98146fa57bdab5a0b756833d6c9db2bcea8123b916b0c2baadfdc6f12" }, "downloads": -1, "filename": "pigpio_encoder-0.2.1.tar.gz", "has_sig": false, "md5_digest": "cea9382690ece47fde8b1d7ab48c96cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3989, "upload_time": "2019-02-05T01:56:33", "url": "https://files.pythonhosted.org/packages/b2/3e/c2388c1967296df703ecbbc9805a3a620ec72ad2f88f1c545aef5c00cd04/pigpio_encoder-0.2.1.tar.gz" } ] }