{"id":13802307,"url":"https://github.com/martinohanlon/pico-rgbkeypad","last_synced_at":"2025-10-23T23:31:44.172Z","repository":{"id":45111733,"uuid":"340874602","full_name":"martinohanlon/pico-rgbkeypad","owner":"martinohanlon","description":"A Python class for controlling the Pimoroni RGB Keypad for Raspberry Pi Pico","archived":false,"fork":false,"pushed_at":"2022-01-09T14:55:10.000Z","size":28,"stargazers_count":66,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-27T01:52:52.809Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/martinohanlon.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-02-21T10:33:41.000Z","updated_at":"2024-12-03T06:28:22.000Z","dependencies_parsed_at":"2022-09-23T07:22:53.211Z","dependency_job_id":null,"html_url":"https://github.com/martinohanlon/pico-rgbkeypad","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinohanlon%2Fpico-rgbkeypad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinohanlon%2Fpico-rgbkeypad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinohanlon%2Fpico-rgbkeypad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinohanlon%2Fpico-rgbkeypad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinohanlon","download_url":"https://codeload.github.com/martinohanlon/pico-rgbkeypad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243735798,"owners_count":20339531,"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-08-04T00:01:41.690Z","updated_at":"2025-10-23T23:31:39.141Z","avatar_url":"https://github.com/martinohanlon.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["IO"],"readme":"# rgbkeypad\n\nA Python class for controlling the [Pimoroni RGB Keypad](https://shop.pimoroni.com/products/pico-rgb-keypad-base) for the [Raspberry Pi Pico](https://www.raspberrypi.org/documentation/pico/getting-started/).\n\nCompatible with MicroPython and CircuitPython.\n\n```python\nkeypad = RGBKeypad()\n\n# make all the keys red\nkeypad.color = (255, 0, 0)\n\n# turn a key blue when pressed\nwhile True:\n    for key in keypad.keys:\n        if key.is_pressed():\n            key.color = (0, 0, 255)\n```\n\n![pimoroni rgb keypad](https://cdn.shopify.com/s/files/1/0174/1800/products/pico-addons-2_1024x1024.jpg?v=1611177905)\n\n# Status\n\nBeta - version 0.2\n\n## Install\n\nThere are a few options for installing `pico rgbkeypad`:\n\n1. Copy the [rbgkeypad.py code](https://github.com/martinohanlon/pico-rgbkeypad/blob/main/rgbkeypad/rgbkeypad.py) into the top of your program.\n\n2. Copy the [rgbkeypad folder](https://github.com/martinohanlon/pico-rgbkeypad/blob/main/rgbkeypad) to the lib folder on your pico (useful if you are using CircuitPython).\n\n3. Install the [pico-rgbkeypad package from PyPi](https://pypi.org/project/pico-rbgkeypad) using `upip` or the [Manage Packages tool](https://github.com/thonny/thonny/wiki/InstallingPackages) in [Thonny](https://thonny.org/).\n\n## Usage\n\nHere you will find some typical use cases and examples for using `rgbkeypad`. See the [API](API.md) documentation for more information.\n\nImport the `RGBKeypad` class from the `rgbkeypad` module.\n\n\u003e Note - you do not need to import the module if you copied the `rgbkeypad.py` code directly into your program.\n\n```python\nfrom rgbkeypad import RGBKeypad\n```\n\nCreate a keypad object.\n\n```python\nkeypad = RGBKeypad()\n```\n\n### Display\n\nThe color of all the keys can be changed by setting the key pad's `color` property to a tuple of (red, green, blue) values between `0` and `255`.\n\n```python\n# red\nkeypad.color = (255, 0, 0)\n\n# green\nkeypad.color = (0, 255, 0)\n\n# blue\nkeypad.color = (0, 0, 255)\n\n# white\nkeypad.color = (255, 255, 255)\n\n# yellow\nkeypad.color = (255, 255, 0)\n\n# purple\nkeypad.color = (128, 0, 128)\n```\n\nThe brightness can be changed by setting the `brightness` property to a value between `0` and `1`. Where `1` is full brightness and `0` is off. By default the brightness is set to `0.5`.\n\n```python\nkeypad.brightness = 1\n```\n\nThe keypad can be cleared (turned off) using the `clear()` method.\n\n```python\nkeypad.clear()\n```\n\nIndividual keys can be referenced using their x,y position e.g. [0,0]\n\n```python\nkey1 = keypad[0, 0]\n```\n\nIndividual key's color and brightness can be set using the `color` and `brightness` properties.\n\n```python\n# red\nkey1.color = (255, 0, 0)\n\n# full brightness\nkey1.brightness = 1\n```\n\nAn individual key can also be cleared using the `clear()` method.\n\n```python\nkey1.clear()\n```\n\n### Press\n\nThe status of the key can be retrieved using the `is_pressed()` method of an individual key.\n\n```python\nkey1 = keypad[0, 0]\npressed = key1.is_pressed()\n```\n\nUse a loop to continuously check the status of a key.\n\n```python\nwhile True:\n    if key1.is_pressed():\n        print(\"key 1 pressed\")\n```\n\nTo check the status of all the keys, loop through the keypad's `keys` property, check each individually.\n\n```python\nwhile True:\n    for key in keypad.keys:\n        if key.is_pressed():\n            print(\"key\", key.x, key.y, \"pressed)\n```\n\nAlternatively a list of all the keys pressed status can be obtained using the key pad's `get_keys_pressed()` method.\n\n```python\nkeys_pressed = keypad.get_keys_pressed()\nprint(keys_pressed)\n```\n\n## Deploy\n\nThese are instructions for how to deploy the `pico-rgbkeypad` to [PyPI](https://pypi.org/project/pico-rbgkeypad)\n\n1. Install pre-requisites\n\n~~~bash\npip3 install setuptools twine\n~~~\n\n2. Increment version number in `setup.py`, `README.md` and `CHANGELOG.MD`\n\n3. Build for deployment\n\n~~~bash\npython setup.py sdist\n~~~\n\n3. Deploy to PyPI\n\n~~~bash\ntwine upload dist/* --skip-existing\n~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinohanlon%2Fpico-rgbkeypad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinohanlon%2Fpico-rgbkeypad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinohanlon%2Fpico-rgbkeypad/lists"}