mBlock 5 Extension Builder provides powerful functions. Its abundant configuration items allow you to develop various extensions. The configuration of extensions, however, may be too complicated for beginners.
To improve the experience of beginners, we provide an predefined Arduino template in version V1.3.2 to help them develop an Arduino extension more easily. The predefined Arduino template is developed based on the common development needs of Arduino extensions. It simplifies the process and configuration for developing an Arduino extension.
For details about how to use the Arduino template, see Default Arduino Template.
In the versions earlier than V1.3.2, you can develop device and sprite extensions for various hardware devices by configuring detail parameters. In V1.3.2 or later, this configuration mode is defined as using a Universal template.
For details about how to use the universal template, see Universal Template.
We will develop more templates for the development of common extensions to help developers develop extensions more easily.
If you have any suggestions or feedback, contact us at firstname.lastname@example.org.
Default Arduino Template
To help third-party developers develop extensions more easily, we provide a predefined template named Default Arduino template, simplifying parts of the development process. With this template, developers can focus only on configuration items required for Arduino extensions.
In short, if you want to develop an Arduino extension, choose this template.
Steps for the template
1. Choose the template
Choose My Plugin > My Extension, click Add extension, select Default Arduino template in the dialog box that appears, and click OK.
2. Set the extension name
Name your extension and click OK.
3. Configure blocks
(1) Basic configuration
The first category and its first block have been added automatically.
Configure the first block.
In Other blocks configuration, enter the code to be executed when the block is running, and select the options for the block.
When block is running (onRun), execute: Generally, this is used to configure the code to be executed in Live mode
In the block options:
- Enlarge gap between two blocks: increases the spacing between this block and its adjacent block in the Blocks area on mBlock 5, which facilitates the grouping of this block
- Default transcoding for scripts in combination with this block: generally indicates that this block is used as an Events block (blocks can be transcoded only when they are put under an Events block
- This block comes with a checkbox for reading value: provides this block with a returned value that can be displayed on the stage in real time (this option is available only for blocks of the numeric and character string types)
(2) Add source file
Click the Add source file tab and drag the library file to the rectangle.
Add the blocks you need and configure them by referring to steps (1) and (2).
Now, an Arduino extension has been created. After saving the blocks, you can click Preview in the upper right corner to preview the extension.
(3) Advanced configuration
If you need to further configure the extension, you can click the Advanced configuration tab to set more information.
(4) Translation settings
You can translate your extension into multiple languages on the Translation settings tab, so that it can be used by users of different countries.
After completing the configuration, you can click Preview in the upper right corner to preview the extension.
For more details about how to configure an extension, see [Arduino] Create an LED Extension (Using the Default Arduino Template).
The universal template on Extension Builder can be used to create any type of extensions. You can use the universal template to create extensions for both devices and sprites.
1. Choose the template
Choose My Plugin > My Extension, click Add extension, select Universal template, and click OK.
2. Set the basic information
Set the basic information of the extension and click OK.
Note: Fields with the asterisk * must be set.
3. Enter the editing page of the extension
Return to the My Extension list and click the Edit button of the extension to be modified.
4. Configure the extension
On the editing page, add blocks and set all the required information for the extension.
After complete the configuration, you can click Preview in the upper-right corner of the page to preview the extension.
Differences between the universal and default Arduino template
- You need to select the platform the extension supports.
- You need to set the devices (or sprites) the extension supports.
- You need to upload source files on the Common code settings tab.
- You need to set the supported transcoding language (Arduino C is set as the default transcoding languange in the default Arduino template).
For more details about how to use the universal template to develop an extension, refer to the following examples:
- [Arduino] Create an LED Extension (Using the Universal Template)
- [micro:bit] Create an Extension for micro:bit
- [Sprites] Create an Extension for Sprites