{"id":22468506,"url":"https://github.com/projectweekend/pi-pin-manager","last_synced_at":"2025-08-02T08:32:23.402Z","repository":{"id":24841451,"uuid":"28256297","full_name":"projectweekend/Pi-Pin-Manager","owner":"projectweekend","description":"Setup Raspberry Pi GPIO pins using a configuration file, not boilerplate.","archived":false,"fork":false,"pushed_at":"2015-09-23T02:38:48.000Z","size":512,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-23T20:53:59.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projectweekend.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-20T04:07:47.000Z","updated_at":"2024-01-07T02:46:53.000Z","dependencies_parsed_at":"2022-08-23T07:31:32.175Z","dependency_job_id":null,"html_url":"https://github.com/projectweekend/Pi-Pin-Manager","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Pin-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Pin-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Pin-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Pin-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectweekend","download_url":"https://codeload.github.com/projectweekend/Pi-Pin-Manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228453982,"owners_count":17922585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T11:17:00.240Z","updated_at":"2024-12-06T11:17:01.262Z","avatar_url":"https://github.com/projectweekend.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Boilerplate code is annoying and sometimes there can be a lot of it working with [Raspberry Pi GPIO](https://pypi.python.org/pypi/RPi.GPIO). I got tired of setting the board mode and declaring GPIO channels in every script so I made a library that uses a config file instead. In addition to getting rid of the boilerplate, **Pi-Pin-Manager** offers a cleaner interface for working with [RPi.GPIO](https://pypi.python.org/pypi/RPi.GPIO).\n\n\n### Install it\n\n```\npip install Pi-Pin-Manager\n```\n\n#### Example Config File\n\nThe following snippet shows an example configuration file:\n\n```yaml\n18:\n  mode: OUT\n  initial: LOW\n23:\n  mode: OUT\n  initial: HIGH\n24:  \n  mode: IN\n  resistor: PUD_UP\n```\n\n\n#### Notes\n\n* Add a numbered item for each pin\n* `mode` - This controls whether the pin will be used for input or output. Accepted values are: `IN`, `OUT`. (Required)\n* `initial` - This controls the starting value of the pin. Accepted values are: `LOW`, `HIGH`. (Optional - defaults to `LOW`)\n* `resistor` - This controls the software defined pull up/pull down resistor available in the Broadcom SOC. Accepted values are: `PUD_UP`, `PUD_DOWN`, `PUD_OFF`. (Optional - defaults to `PUD_OFF`)\n\nFor full documentation about available GPIO input pin configurations see the [documentation](http://sourceforge.net/p/raspberry-gpio-python/wiki/Examples/).\n\n\n#### Example\n\nThe following snippet demonstrates a `PinManager` instance using the example config file referenced above. The `PinManager` instance will have named attributes for each pin number you defined in the config file.\n\n```python\nimport RPi.GPIO as GPIO\nfrom pi_pin_manager import PinManager\n\n\nCONFIG_FILE = 'path/to/config/file.yml'\n\nmanager = PinManager(config_file=CONFIG_FILE, gpio=GPIO)\n\n# Turn on pin 18\nmanager.pin_18.on()\n\n# Turn off pin 18\nmanager.pin_18.off()\n\n# Read pin 18\nmanager.pin_18.read()\n\n# Settings dictionary for pin 18\nmanager.pin_18.settings\n\n\n# Attach an action to pin with threaded callback\ndef my_action(channel):\n    # do something here\n    pass\n\n# Valid event types: RISING, FALLING, BOTH\nmanager.pin_18.attach_action(event_type='RISING', action=my_action, bounce=200)\n```\n\n\n#### Run Tests\n\n```\nnosetests -v --with-coverage --cover-erase --cover-package=pi_pin_manager --cover-html\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-pin-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectweekend%2Fpi-pin-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-pin-manager/lists"}