{"id":22253880,"url":"https://github.com/mcauser/microbit-my9221","last_synced_at":"2026-04-28T00:32:40.859Z","repository":{"id":150620610,"uuid":"118924061","full_name":"mcauser/microbit-my9221","owner":"mcauser","description":"MicroPython for micro:bit library for 10 segment LED bar graph modules using the MY9221 LED driver","archived":false,"fork":false,"pushed_at":"2018-08-07T15:40:29.000Z","size":500,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T07:50:37.624Z","etag":null,"topics":["grove","leds","microbit","microbit-scripts","micropython","my9221"],"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/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:35:35.000Z","updated_at":"2018-08-07T15:40:30.000Z","dependencies_parsed_at":"2023-05-06T09:33:11.390Z","dependency_job_id":null,"html_url":"https://github.com/mcauser/microbit-my9221","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mcauser/microbit-my9221","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicrobit-my9221","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicrobit-my9221/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicrobit-my9221/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicrobit-my9221/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcauser","download_url":"https://codeload.github.com/mcauser/microbit-my9221/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicrobit-my9221/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32361477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","microbit","microbit-scripts","micropython","my9221"],"created_at":"2024-12-03T07:20:41.651Z","updated_at":"2026-04-28T00:32:40.815Z","avatar_url":"https://github.com/mcauser.png","language":"Python","funding_links":[],"categories":["🐍 Python"],"sub_categories":["🐍 MicroPython Libraries"],"readme":"# BBC micro:bit MicroPython MY9221\n\nA micro:bit 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## Installation\n\n* Install MicroPython for micro:bit by either compiling from [source](https://github.com/bbcmicrobit/micropython) or using one of my [precompiled firmwares](https://github.com/mcauser/microbit-tm1637/tree/master/firmware)\n* Install [ufs](https://github.com/ntoll/microfs) to upload .py scripts\n* Copy `my9221.py` and one of the example `main.py` scripts to the micro:bit\n* Reset to run `main.py` on boot.\n\n# Examples\n\n```python\nfrom microbit import *\nfrom my9221 import MY9221\nledbar = MY9221(di=pin1, dcki=pin2, reverse=False)\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 /examples.\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* [BBC micro:bit](https://tronixlabs.com.au/bbc-micro-bit/bbc-micro-bit-board-only-retail-pack-australia/) $24.95 AUD\n* [Edge Connector Breakout Board](https://tronixlabs.com.au/bbc-micro-bit/edge-connector-breakout-board-for-bbc-micro-bit-australia/) $11.95 AUD\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\nmicro:bit | Grove LED Bar\n--------- | ---------------\nPin 1     | DI (yellow)\nPin 2     | DCKI (white)\n3V3       | VCC (red)\nGND       | GND (black)\n\nAn edge connector breakout board comes in handy here.\n\nYou're welcome to change the data and clock pins to something else - just update `MY9221(di=pin1, dcki=pin2)` in your `main.py`\n\n## Links\n\n* [BBC micro:bit](http://microbit.org/)\n* [MicroPython for the BBC micro:bit](https://github.com/bbcmicrobit/micropython)\n* [Kitronik Edge Connector Breakout Board](https://www.https://www.kitronik.co.uk/5601b-edge-connector-breakout-board-for-bbc-microbit-pre-built.html.co.uk/5601b-edge-connector-breakout-board-for-bbc-microbit-pre-built.html)\n* [Grove LED Bar Wiki Page](http://wiki.seeed.cc/Grove-LED_Bar/)\n* [micropython.org](http://micropython.org)\n* [micro:bit on the MicroPython forum](https://forum.micropython.org/viewforum.php?f=17)\n* [microfs](https://github.com/ntoll/microfs)\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* [MicroPython MY9221](https://github.com/mcauser/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%2Fmicrobit-my9221","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcauser%2Fmicrobit-my9221","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicrobit-my9221/lists"}