{"id":13613289,"url":"https://github.com/mcauser/micropython-my9221","last_synced_at":"2026-03-12T17:04:50.811Z","repository":{"id":150620693,"uuid":"118924168","full_name":"mcauser/micropython-my9221","owner":"mcauser","description":"MicroPython driver for MY9221 10-segment LED bar graph modules","archived":false,"fork":false,"pushed_at":"2018-08-07T16:18:04.000Z","size":523,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-28T05:51:14.171Z","etag":null,"topics":["grove","leds","micropython","my9221","wemos-d1-mini"],"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}},"created_at":"2018-01-25T14:36:23.000Z","updated_at":"2024-03-11T16:58:19.000Z","dependencies_parsed_at":"2023-05-14T10:00:43.554Z","dependency_job_id":null,"html_url":"https://github.com/mcauser/micropython-my9221","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcauser/micropython-my9221","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-my9221","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-my9221/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-my9221/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-my9221/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcauser","download_url":"https://codeload.github.com/mcauser/micropython-my9221/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-my9221/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30434109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","leds","micropython","my9221","wemos-d1-mini"],"created_at":"2024-08-01T20:00:43.450Z","updated_at":"2026-03-12T17:04:50.796Z","avatar_url":"https://github.com/mcauser.png","language":"Python","funding_links":[],"categories":["精选驱动库","Libraries"],"sub_categories":["显示类","Display"],"readme":"# MicroPython MY9221\n\nA MicroPython library for 10 segment LED bar graph modules using the MY9221 LED driver.\n\nFor example, the [Grove - LED Bar module](http://wiki.seeed.cc/Grove-LED_Bar/)\n\n![demo](docs/demo.jpg)\n\n## Examples\n\nCopy the file to your device, using ampy, webrepl or compiling and deploying. eg.\n\n```\n$ ampy put my9221.py\n```\n\n**Basic usage**\n\n```python\nfrom my9221 import MY9221\nfrom machine import Pin\nledbar = MY9221(di=Pin(4), dcki=Pin(5))\n\n# all LEDS on, full brightness\nledbar.level(10)\n\n# four LEDS on, half brightness\nledbar.level(4, 0x0F)\n\n# first and last LED on\nledbar.bits(0b1000000001)\nledbar.bits(0x201)\nledbar.bits(513)\n\n# alternating LEDs\nledbar.bits(0b0101010101)\nledbar.bits(0b1010101010)\n\n# fade out LEDs\nbuf = bytearray([0,1,3,7,15,31,63,127,255,255])\nledbar.bytes(buf)\n\n# reverse orientation, first LED is green\nledbar.reverse(True)\nledbar.level(1)\n\n# normal orientation, first LED is red\nledbar.reverse(False)\nledbar.level(1)\n```\n\nFor more detailed examples, see [my9221_test.py](my9221_test.py)\n\n# Methods\n\nGet or set the orientation.\nThe red LED normally position 1, and when reversed is position 10.\nOnce orientation has been set, all other methods respect the order.\n```\nreverse(val=None)\n```\n\nIlluminate a number of LEDs at a specific brightness.\nA value of 5 would light half of the display.\n```\nlevel(val, brightness=255)\n```\n\nIlluminate LEDs, one bit per LED at a specific brightness.\nValue can be 0-1023.\n```\nbits(val, brightness=255)\n```\n\nUse a bytearray, one byte per LED, to specify individual brightness for each LED.\n```\nbytes(buf)\n```\n\n## Parts\n\n* [WeMos D1 Mini](https://www.aliexpress.com/store/product/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/1331105_32529101036.html) $3.50 USD\n* [Grove LED Bar](https://www.seeedstudio.com/Grove-LED-Bar-v2.0-p-2474.html) $3.90 USD\n* [Grove Male Jumper Cable](https://www.seeedstudio.com/Grove-4-pin-Male-Jumper-to-Grove-4-pin-Conversion-Cable-%285-PCs-per-Pack%29-p-1565.html) $2.90 USD\n\n## Connections\n\nWeMos D1 Mini | Grove LED Bar\n------------- | ---------------\nD2 (GPIO4)    | DI (yellow)\nD1 (GPIO5)    | DCKI (white)\n3V3 (or 5V)   | VCC (red)\nG             | GND (black)\n\n## Links\n\n* [WeMos D1 Mini](https://wiki.wemos.cc/products:d1:d1_mini)\n* [micropython.org](http://micropython.org)\n* [MY9221 datasheet](https://raw.githubusercontent.com/SeeedDocument/Grove-LED_Bar/master/res/MY9221_DS_1.0.pdf)\n* [My Semi MY9221 product page](http://www.my-semi.com/content/products/product_mean.aspx?id=9)\n* [BBC micro:bit version](https://github.com/mcauser/microbit-my9221)\n* [Adafruit Ampy](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy)\n* [micropython-my9221 on pypi](https://pypi.python.org/pypi/micropython-my9221/)\n\n## License\n\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-my9221","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcauser%2Fmicropython-my9221","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-my9221/lists"}