{"id":13880940,"url":"https://github.com/microsoft/pxt-microbit","last_synced_at":"2025-05-13T22:11:30.553Z","repository":{"id":37595433,"uuid":"53611065","full_name":"microsoft/pxt-microbit","owner":"microsoft","description":"A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode","archived":false,"fork":false,"pushed_at":"2025-05-07T00:42:34.000Z","size":332247,"stargazers_count":760,"open_issues_count":471,"forks_count":659,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-05-07T01:38:19.172Z","etag":null,"topics":["blockly","code","editor","education","makecode","microbit","pxt","typescript"],"latest_commit_sha":null,"homepage":"https://makecode.microbit.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"docs/support.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-10T19:27:31.000Z","updated_at":"2025-05-06T20:02:39.000Z","dependencies_parsed_at":"2023-12-19T19:48:53.120Z","dependency_job_id":"19ce7ee6-828e-49a1-b076-530b13d9ab51","html_url":"https://github.com/microsoft/pxt-microbit","commit_stats":{"total_commits":5851,"total_committers":141,"mean_commits":41.49645390070922,"dds":0.6745855409331738,"last_synced_commit":"1226ac8de5640f426cbe84636cdc55669bae2c1b"},"previous_names":[],"tags_count":1523,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpxt-microbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpxt-microbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpxt-microbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpxt-microbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/pxt-microbit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036842,"owners_count":22003654,"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":["blockly","code","editor","education","makecode","microbit","pxt","typescript"],"created_at":"2024-08-06T08:03:41.284Z","updated_at":"2025-05-13T22:11:25.542Z","avatar_url":"https://github.com/microsoft.png","language":"TypeScript","readme":"# micro:bit target for PXT\n\n[![Build Status](https://travis-ci.org/microsoft/pxt-microbit.svg?branch=master)](https://travis-ci.org/microsoft/pxt-microbit) ![pxt-testghpkgs](https://github.com/microsoft/pxt-microbit/workflows/pxt-testghpkgs/badge.svg)\n\npxt-microbit is a [Microsoft Programming Experience Toolkit (PXT)](https://github.com/Microsoft/pxt) target that allows you to program a [BBC micro:bit](https://microbit.org/). \n\n* pxt-microbit **beta**, ``v3.0.*`` requires \n  * [pxt-microbit#stable3.0](https://github.com/Microsoft/pxt-microbit/tree/stable3.0)\n  * [pxt#stable6.0](https://github.com/Microsoft/pxt/tree/stable6.0).\n  * [pxt-common-packages#stable6.0](https://github.com/Microsoft/pxt-common-packages/tree/stable7.0).\n* pxt-microbit ``v2.0.*``, branch ``stable2.0``, requires [pxt v5.15.\\*](https://github.com/microsoft/pxt/tree/stable5.15). It is the servicing branch for live editor.\n* pxt-microbit ``v1.*`` requires pxt v4.4, which is currently in the [stable4.4 branch of pxt](https://github.com/Microsoft/pxt/tree/stable4.4).\n* pxt-microbit ``v0.*`` is in the [v0 branch of this repository](https://github.com/microsoft/pxt-microbit/tree/v0)\n\n* [Try it live](https://makecode.microbit.org/)\n\n## Issue tracking\n\nPlease add an issue if you discover an (unreported) bug.\n\n## Developing new extensions\n\nAuthoring and testing of new extensions can be done directly from the web editor. See [our documentation](https://makecode.com/blog/github-packages) on how to get started. If you want to run the editor locally, keep reading.\n\n## Local server setup\n\nThe local server lets you to run the editor and serve the documentation from your own computer. It is meant for a single developer used and not designed to serve the editor to a large amount of users.\n\n1. Install [Node.js](https://nodejs.org/) 8.9.4 or higher.\n2. Clone this repository.\n```\ngit clone https://github.com/microsoft/pxt-microbit\ncd pxt-microbit\n```\n3. Install the PXT command line (add `sudo` for Mac/Linux shells).\n```\nnpm install -g pxt\n```\n4. Install the pxt-microbit dependencies.\n```\nnpm install\n```\n\nGo to the **Running** section.\n\n### Developer Setup\n\nThis is the typical setup used by the MakeCode team to work on the microbit.\n\n1. Install [Node.js](https://nodejs.org/) 8.9.4 or higher.\n2. Install [Docker](https://www.docker.com/get-started) if you plan to build ``.cpp`` files.\n3. Clone the pxt repository.\n```\ngit clone https://github.com/microsoft/pxt\ncd pxt\n```\n4. Install the dependencies of pxt and build it\n```\nnpm install\nnpm run build\ncd ..\n```\n5. Clone the pxt-common-packages repository\n```\ngit clone https://github.com/microsoft/pxt-common-packages\ncd pxt-common-packages\nnpm install\n```\n\n6. Link pxt-common-packages to pxt\n```\nnpm link ../pxt\ncd ..\n```\n\n7. Clone this repository.\n```\ngit clone https://github.com/microsoft/pxt-microbit\ncd pxt-microbit\n```\n8. Install the PXT command line (add `sudo` for Mac/Linux shells).\n```\nnpm install -g pxt\n```\n9. Install the pxt-microbit dependencies.\n```\nnpm install\n```\n10. Link pxt-microbit back to base pxt repo (add `sudo` for Mac/Linux shells). \nThis step is only required if you intend to make changes to pxt and/or \npxt-common-packages repos. If all you want is serve a local Makecode, you can skip\nthis step.\n```\nnpm link ../pxt ../pxt-common-packages\n```\nNote the above command assumes the folder structure of   \n```\n       makecode\n          |\n  ----------------------------------\n  |       |                        |\n pxt      pxt-common-packages  pxt-microbit\n ```\n\n### Running\n\nRun this command from inside pxt-microbit to open a local web server\n```\npxt serve\n```\nIf the local server opens in the wrong browser, make sure to copy the URL containing the local token. \nOtherwise, the editor will not be able to load the projects.\n\nIf you need to modify the `.cpp` files (and have installed yotta), enable yotta compilation using the `--localbuild` flag:\n```\npxt serve --local\n```\n\nIf you want to speed up the build, you can use the ``rebundle`` option, which skips building and simply refreshes the target information\n```\npxt serve --rebundle\n```\n\n### Cleaning\n\nSometimes, your built folder might be in a bad state, clean it and try again.\n```\npxt clean\n```\n\n\n### Building with CODAL locally\n\nThe following commands force a local build using CODAL.\n\n```\npxt buildtarget --local\n```\n\nTo disable docker, run\n\n```\nexport PXT_NODOCKER=1\n```\n\nIf you are also modifiying CODAL, consider running ``pxt clean`` to ensure the proper branch is picked up.\n\n### Modifying DAL/CODAL locally\n\n* follow instructions above until `pxt serve`\n* open editor on localhost and create a project\n* do `export PXT_FORCE_LOCAL=1 PXT_RUNTIME_DEV=1 PXT_ASMDEBUG=1`; you can add `PXT_NODOCKER=1`; `pxt help` has help on these\n* find project folder under `pxt-microbit/projects`, typically `pxt-microbit/projects/Untitled-42`\n* if you're going to modify `.cpp` files in PXT, replace `\"core\": \"*\"` in `pxt.json` with `\"core\": \"file:../../libs/core\"`;\n  similarly `\"radio\": \"file:../../libs/radio\"` and `\"microphone\": \"file:../../libs/microphone\"`\n* you can edit `main.ts` to change the PXT side of the program; you can also edit it from the localhost editor;\n  note that `Download` in the localhost editor will produce different binary than command line, as it builds in the cloud\n  and uses tagged version of CODAL\n* in that folder run `pxt build` - this will clone codal somewhere under `built/` (depends on build engine and docker)\n* there can be an issue with exporting the variables i.e. PXT_FORCE, so including them in the build command can help solve issues `sudo PXT_NODOCKER=1 PXT_ASMDEBUG=1 PXT_RUNTIME_DEV=1 PXT_DEBUG=1 PXT_FORCE_LOCAL=1 PXT_COMPILE_SWITCHES=csv---mbcodal pxt build`\n* if the target is not building, delete files in `hexcache` found in `pxt-microbit/built/hexcache` to force local build\n* the built hex can be found in `pxt-microbit/projects/\u003cyour project name\u003e/built` named `binary.hex`\n* similarly, you can run `pxt deploy` (or just `pxt` which is the same) - it will build and copy to `MICROBIT` drive\n* assuming the build folder is under `built/codal`, go to `built/codal/libraries` and run `code *`\n* in git tab, checkout appropriate branches (they are all in detached head state to the way we tag releases)\n* modify files, run `pxt`, see effects\n* you can also run `pxt gdb` to debug; this requires `openocd`\n* other commands using `openocd` are `pxt dmesg` which dumps `DMESG(...)` buffer and `pxt heap` which can be used to visualize PXT heap \n  (and CODAL's one to some extent)\n\n### Updating dal.d.ts\n\n```\ncd libs/blocksprj\nrm -rf built\nPXT_FORCE_LOCAL=1 PXT_COMPILE_SWITCHES=csv---mbcodal pxt build\nPXT_FORCE_LOCAL=1 PXT_COMPILE_SWITCHES=csv---mbcodal pxt builddaldts\nmv dal.d.ts ../core\n```\n\n### Updates\n\nMake sure to pull changes from all repos regularly. More instructions are at https://github.com/Microsoft/pxt#running-a-target-from-localhost\n\n## Update playlists in markdown\n\nTo add a new playlist, add an entry in ``/playlists.json``, and regenerate the markdown (see paragraph below). You'll now have a new markdown gallery file listing the videos which you can reference in ``/targetconfig.json``.\n\nGet a Google API key and store it in the ``GOOGLE_API_KEY`` environment variables (turn on data from the app).\n\n```\npxt downloadplaylists\n```\n\n## Repos \n\nThe pxt-microbit target depends on several other repos. The main ones are:\n- https://github.com/Microsoft/pxt, the PXT framework\n- https://github.com/Microsoft/pxt-common-packages, common APIs accross various MakeCode editors\n- https://github.com/lancaster-university/microbit, basic wrapper around the DAL\n- https://github.com/lancaster-university/microbit-dal\n\n## History\n\nSee the [MakeCode blog](https://makecode.com/blog).\n\n## Code of Conduct\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks\n\nMICROSOFT, the Microsoft Logo, and MAKECODE are registered trademarks of Microsoft Corporation. They can only be used for the purposes described in and in accordance with Microsoft’s Trademark and Brand guidelines published at https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general.aspx. If the use is not covered in Microsoft’s published guidelines or you are not sure, please consult your legal counsel or MakeCode team (makecode@microsoft.com).\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpxt-microbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fpxt-microbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpxt-microbit/lists"}