Repository navigation
micro:bit: starter programs in the learner's microbit folder - #49
Merged
Merged
Conversation
Six short examples for V1 and V2 (hello, buttons, heartbeat, dice, tilt_plot for the Plotter, score_keeper saving a file on the board), copied into <workspace>/microbit/examples by ensure_workspace_assets the first time micro:bit mode is used; an existing folder is left alone. A test checks every name each takes from `microbit` is one the micro:bit has. Documented in docs/microbit.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amples # Conflicts: # plugins/microbit/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gives a learner something to start from in micro:bit mode. Pygame Zero already copies demo assets into the workspace on first use; micro:bit mode gave an empty folder.
nu_microbit/examples/, each with a header saying what it does and what to try:hello.py,buttons.py,heartbeat.py,dice.py(shake to roll)tilt_plot.py, for the Plotterscore_keeper.py, which savesscore.txton the board so there's something to see with Files (micro:bit Files pane, on plugin API 0.6 (panes) #48)MicrobitMode.ensure_workspace_assetscopies them into<workspace>/microbit/examplesthe first time the mode is used. An existing folder is left alone, so the learner's edits and deletions stick.from microbit import *is one the micro:bit has (the mode'sstar_importslist).docs/microbit.mdgets a table of the examples. README, TODO.md and CHANGES.md updated.Independent of #48, though
score_keeper.py's header and the docs mention Files, so it reads best merged after it.Tested
mkdocs build --strictclean.nu_microbit/examples/*.py.display,Image.HEART_SMALL,button_*.was_pressed,accelerometer.was_gesture("shake"),open()on the board's file system).🤖 Generated with Claude Code