Open this page at GitHub Pages: https://jp-rad.github.io/pxt-ubit-extension/
Extensions are PXT’s dynamic/static library mechanism for extending a target, such as the pxt-micro:bit:
- open the repository on github.
https://github.com/jp-rad/pxt-ubit-extension - click Use this template.
Here - https://github.com/jp-rad/pxt-ubit-extension/generate - settings for your new repository.
Settings > Actions > General > Workflow permissions: Read and write permissions
Settings > Pages > branch: master
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/jp-rad/pxt-ubit-extension and import
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/jp-rad/pxt-ubit-extension and click import
https://makecode.microbit.org/blocks-embed
Copy the following text at the bottom of your README.md file.
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/jp-rad/pxt-ubit-extension/.github/statics/gh-pages-img.css">
<script src="https://cdn.jsdelivr.net/gh/jp-rad/pxt-ubit-extension/.github/statics/gh-pages-embed.js"></script>
<script>makeCodeRender("{{ site.makecode.home_url }}", [ "custom=github:jp-rad/pxt-ubit-extension", ]);</script>
Example1
custom.foo(4, "Hello", MyEnum.One)
Example2
input.onButtonPressed(Button.A, function () {
basic.showNumber(custom.baz())
})
input.onButtonPressed(Button.B, function () {
basic.showNumber(custom.bar())
})
Released HEX file can be imported as an extension in MakeCode.
- open https://github.com/jp-rad/pxt-ubit-extension/releases
- download HEX file
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- click on Import File
- select downloaded HEX file and click on Go ahead!
- for PXT/microbit