{"id":13613315,"url":"https://github.com/mcauser/micropython-p9813","last_synced_at":"2025-10-25T19:30:49.808Z","repository":{"id":57441496,"uuid":"94195555","full_name":"mcauser/micropython-p9813","owner":"mcauser","description":"MicroPython driver for P9813 chainable RGB LEDs","archived":false,"fork":false,"pushed_at":"2024-02-13T14:51:47.000Z","size":1470,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-22T16:57:00.431Z","etag":null,"topics":["grove","grove-chainable-rgb-led","micropython","p9813","rgb-led"],"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/mcauser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-13T09:30:20.000Z","updated_at":"2025-08-27T12:13:06.000Z","dependencies_parsed_at":"2024-09-14T04:02:36.727Z","dependency_job_id":null,"html_url":"https://github.com/mcauser/micropython-p9813","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"9dd5d5bb7846c635000d0d2ec1d60358b8dfa816"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mcauser/micropython-p9813","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-p9813","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-p9813/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-p9813/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-p9813/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcauser","download_url":"https://codeload.github.com/mcauser/micropython-p9813/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-p9813/sbom","scorecard":{"id":631714,"data":{"date":"2025-08-11","repo":{"name":"github.com/mcauser/micropython-p9813","commit":"9dd5d5bb7846c635000d0d2ec1d60358b8dfa816"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T08:07:00.828Z","repository_id":57441496,"created_at":"2025-08-21T08:07:00.828Z","updated_at":"2025-08-21T08:07:00.828Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280987565,"owners_count":26425343,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["grove","grove-chainable-rgb-led","micropython","p9813","rgb-led"],"created_at":"2024-08-01T20:00:44.021Z","updated_at":"2025-10-25T19:30:49.422Z","avatar_url":"https://github.com/mcauser.png","language":"Python","readme":"# MicroPython P9813\n\nA MicroPython library for P9813 RGB LED drivers.\n\nFor example, the Seeed Studio [Grove - Chainable RGB LED](https://wiki.seeedstudio.com/Grove-Chainable_RGB_LED/).\n\n![demo](docs/demo.jpg)\n\n\n### Installation\n\nUsing mip via mpremote:\n\n```bash\n$ mpremote mip install github:mcauser/micropython-p9813\n$ mpremote mip install github:mcauser/micropython-p9813/examples\n```\n\nUsing mip directly on a WiFi capable board:\n\n```python\n\u003e\u003e\u003e import mip\n\u003e\u003e\u003e mip.install(\"github:mcauser/micropython-p9813\")\n\u003e\u003e\u003e mip.install(\"github:mcauser/micropython-p9813/examples\")\n```\n\nManual installation:\n\nCopy `src/p9813.py` to the root directory of your device.\n\n\n## SPI Version\n\nYou can use either HSPI or SPI. This version is significantly faster than the\nbit-bang version. MISO is not used. The LED driver is write only.\n\n### SPI Example\n\n**Basic usage**\n\n```python\nimport p9813\n\nnum_leds = 10\nauto_write = False\n\n# Using Hardware SPI\nfrom machine import SPI, Pin\n\nspi = SPI(1, 10000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19))  # TinyPICO\nchain = p9813.P9813_SPI(spi, num_leds, auto_write)\n\n# Or using Software SPI\n# from machine import SoftSPI, Pin\n# spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck=Pin(4), mosi=Pin(5), miso=Pin(6))  # TinyS2\n# chain = p9813.P9813_SPI(spi, num_leds, auto_write)\n\n# Set the first LED to red. (red, green, blue)\n# In a chain, the first LED is closest to the MCU\nchain[0] = (255, 0, 0)\n\n# Set the second LED to green\nchain[1] = (0, 255, 0)\n\n# Set third LED to blue and forth LED magenta\nchain[2:4] = [(0, 0, 255), (255, 0, 255)]\n\n# Write data to all LEDs\nchain.write()\n\n# What colour is the forth LED?\nprint(chain[3])\n# (255, 0, 255)\n\n# How many LEDs in the chain again?\nprint(len(chain))\n# 10\n\n# What are the first two colours?\nprint(chain[0:2])\n# [(255, 0, 0), (0, 255, 0)]\n\n# What are all the colours?\nprint(chain)\n# [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 0, 255), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)]\n\n# Turn on auto-write, so you don't have to call write() after each change\nchain.auto_write = True\n\n# Make all LEDs red\nchain.fill((255,0,0))\n\n# Make all LEDs green\nchain[0:10] = [\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n    (0, 255, 0),\n]\n\n# Draw a rainbow by modifying the buffer directly\n# Each 4 bytes = 1 LED (checksum, blue, green, red)\nchain._buf = bytearray(b\"\\xc3\\x00\\x00\\xff\\xc6\\x00K\\xb4\\xc9\\x00\\x99f\\xcc\\x00\\xe4\\x1b\\xcc3\\xcc\\x00\\xe4\\x81~\\x00\\xf0\\xcc3\\x00\\xf0\\xe4\\x00\\x1b\\xe1\\x99\\x00f\\xd2K\\x00\\xb4\")\nchain.write()\n\n# Turn off all LEDs\nchain.reset()\n```\n\n\n## Bit Bang Version\n\nThis version works exactly like as the SPI version, only the serial data\nis written by sending pulses on two output pins (clock and data).\n\n### Bit Bang Example\n\n**Basic Usage**\n\n```python\nimport p9813\n\nnum_leds = 10\nauto_write = False\n\nfrom machine import Pin\n\npin_clk = Pin(4, Pin.OUT)\npin_data = Pin(5, Pin.OUT)\nchain = p9813.P9813_BITBANG(pin_clk, pin_data, num_leds, auto_write)\n\n# Make all LEDs red\nchain.fill((255, 0, 0))\n\n# Set the second LED to green\nchain[1] = (0, 255, 0)\n\n# Set the last 8 LEDs to blue\nchain[2:] = [(0, 0, 255)] * 8\n\n# Turn off all LEDs\nchain.reset()\n```\n\nFor more detailed examples, see [examples](/examples).\n\nIf you mip installed them above, you can run them like so:\n\n```python\nimport p9813.examples.basic\n```\n\n\n## Chaining\n\nYou can connect multiple LEDs together to form a chain.\nFor each additional LED, an additional 4 bytes need to be sent per refresh.\nThe more LEDs you add, the longer it takes to write.\n\n\n## Parts\n\n* [Grove - Chainable RGB LED](https://www.seeedstudio.com/Grove-Chainable-RGB-LED.html)\n* [Grove 4P Universal Buckled Cable](https://www.seeedstudio.com/Grove-Universal-4-Pin-Buckled-20cm-Cable-5-PCs-pack.html)\n* [Grove 4P Male Dupont Conversion Cable](https://www.seeedstudio.com/Grove-4-pin-Male-Jumper-to-Grove-4-pin-Conversion-Cable-5-PCs-per-Pack.html)\n* [TinyPICO](https://www.tinypico.com/)\n* [TinyS2](https://unexpectedmaker.com/tinys2)\n* [WeMos D1 Mini](https://www.aliexpress.com/item/32529101036.html)\n\n\n## Connections\n\nGrove Chainable RGB LED | TinyPICO (ESP32)\n----------------------- | ----------------\nCI (clock) (yellow)     | 4\nDI (data) (white)       | 14\nVCC (red)               | 3V3\nGND (black)             | GND\n\nGrove Chainable RGB LED | TinyS2 (ESP32s2)\n----------------------- | ----------------\nCI (clock) (yellow)     | 4\nDI (data) (white)       | 5\nVCC (red)               | 3V3\nGND (black)             | GND\n\nGrove Chainable RGB LED | WeMos D1 Mini (ESP8266)\n----------------------- | -----------------------\nCI (clock) (yellow)     | D2 (GPIO4)\nDI (data) (white)       | D1 (GPIO5)\nVCC (red)               | 3V3 (or 5V)\nGND (black)             | GND\n\nIf you are using the bit-banged version, you can use any output GPIO pins for clock + data.\n\nIf you are using the SPI version, you need to use the SPI pins available to your MCU.\n\nIf you are chaining multiple LEDs, clock out -\u003e clock in, data out -\u003e data in, eg.\n\nLED1 | LED2\n---- | ----\nCO   | CI (yellow)\nDO   | DI (white)\nVCC  | VCC (red)\nGND  | GND (black)\n\n\n## Links\n\n* [micropython.org](http://micropython.org)\n* [P9813 datasheet](docs/P9813_datasheet.pdf)\n* [TinyPICO Getting Started](https://www.tinypico.com/gettingstarted)\n* [WeMos D1 Mini](https://wiki.wemos.cc/products:d1:d1_mini)\n\n\n## License\n\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\n\nCopyright (c) 2017 Mike Causer\n","funding_links":[],"categories":["精选驱动库","Libraries"],"sub_categories":["显示类","Display"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-p9813","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcauser%2Fmicropython-p9813","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-p9813/lists"}