Run your app on your badge
You can test your app on-device, without publishing it, using mpremote
.
- Create a
metadata.json
file in your app's directory. This is necessary only during development. Remove this file before publishing your app to the app store.
{
"name": "<app-name>",
"path": "apps.<folder-name>.<source-name>"
}
The folder name is the name of the folder you will copy the app to. The source name is the name of the Python source file containing your app, without the .py
extension. For example, if your app is in a file called app.py
:
{
"name": "The OG Snake app",
"path": "apps.snake.app"
}
- Install
mpremote
following the installation instructions. - Create the
apps
folder if it doesn't already exist:
mpremote mkdir apps
- Create the folder for your app inside the
apps
folder, for example:
mpremote mkdir apps/snake
- Copy your app files to the new folder:
mpremote cp path/to/app/dir/* :/apps/snake/
For example:
mpremote cp apps/snake/* :/apps/snake/
- Restart your app by holding the reboop button for 2 seconds.
Debug your app on your badge
If your app crashes when it's started, you can get debug information from mpremote
:
- Run
mpremote
to get a shell with access to the device:
mpremote
- Press
CTRL-C
to cancel the current running program and thenCTRL-D
to do a soft-reset while staying connected to the shell. - Now you can use the badge menu to start your app and you will see errors and print statements from your app.