Project files
4 KB
Machine-translated by Robotheca from the original in Japanese (opens in a new tab). License: Apache-2.0 (opens in a new tab).
Block Editor Tutorial
Run the simulator in 5 minutes
- Open the block editor from the web tool.
- From the sample buttons, choose "1. Greeting and expressions".
- Inside "When started", place the expression block you like.
- Press "Build".
- If the diagnostics show no errors, press "Run in simulator".
- Confirm that the face and speech bubble in the simulator change.
Reacting to input in 15 minutes
- In the simulator, choose a button from "Events". On supported hardware, you can also select the head touch sensor or the IMU.
- Inside the event, connect speech, expression, and posture blocks.
- Select the target model and check the diagnostics panel to confirm there are no unsupported capabilities.
- Run it in the simulator and try the input using the A, B, and C buttons at the top of the dialog.
- If you are using real hardware, confirm that it does not stop in the simulator, then press "Write to hardware".
- Check the chip, actual firmware version, XS version, partitions, size, and the capabilities used, then approve the write.
Singing
- From "Chatter", place "Sing the list at tempo 120" inside the event.
- In each list item, add "Sing note C4 for 1 beat with the lyric 'ki'".
- Each item is generated as a triple of "pitch, beat, lyric".
- For each note, specify one kana mora (such as "ki", "kya", "n", or "ー").
- To leave a gap, add a "beat rest" to the list.
- Choose the M5Stack-chan CoreS3 or the web simulator, build, and check playback.
In the generated code, the score becomes a list of triples like this:
[
['C4', 1, 'き'],
['C4', 1, 'ら'],
['R', 0.5, ''],
]
A "ー" that continues a long note carries over the vowel of the preceding lyric. If a lyric has more than one mora, or if a note falls outside the 20–8000 ms range, the MOD raises an error at runtime.
Embedding a Shape-Type Face in 30 Minutes
- Open the "Shape Face Editor" from the web tools.
- Adjust the Face area, the left and right eyes, the eyelids, and the positions and dimensions of the mouth.
- Drag the eyes and mouth on the preview to check the expression and color scheme.
- Press "Use in Block Editor."
- Confirm that "In use" is displayed in the asset field of the Block Editor.
- Confirm that
FaceBase.templateandrobot.ui.setFaceare included in the generated code. - Build and run it in the simulator.
- Save
.stackchan-blocks.jsonusing the project save button. - Also save
.xsa, and manage the editing artifacts and the runtime artifacts separately.
Moving to Code-Based Development
The mod.js tab exposes the same onContextCreated(robot) as a regular MOD.
To continue development locally, save the generated code to mod.js in your MOD directory, and place the project's manifest and assets in the same directory.
While you may still return to the block editor, keep .stackchan-blocks.json as well.
Editing the generated code directly does not convert it back into the original Blockly workspace.
Recovering from failures
Before writing to the device, the target model, firmware, and XS archive compatibility are verified automatically.
When verification passes, the existing MOD is replaced, and the written contents are read back to confirm them.
If you do not want to start the MOD, use "Delete MOD from device."
These operations do not erase the firmware itself.
If the project in the browser cannot be parsed, a warning button appears in the header.
From the warning button, save the recovery JSON, which contains the original data and the error.
Files by @stack-chan, at commit a01f520, read from GitHub in your browser. Hardware license: Apache-2.0; software license: Apache-2.0. Robotheca doesn't review code: read it before running it.