Fireduino Buy

Dual-Core Cortex-M3 processor, integrated high-quality audio Codec and WiFi module, have IOT expansion performance, perfectly compatible with the Arduino interface and Arduino IDE programming, and supports FireBlock graphics programming.

Build Your Own Block

Update time:2018-04-13 Views:5590


FireBlock let you build your own block, by combing the basic blocks together into one advanced block, to archive complex and specific function.

Block Type

There are three basic type of blocks: Command, Reporter and Predicate.

  • Command executes a series of actions, without any return to the caller.

  • Reporter also executes a seris of actions, but has something (numberic, text, boolean or other) to return to the caller.

  • Predicate is actually a special version of Reporter, which returns boolean value (true or false) only to the caller.

Hexagon Example

In this example, we will draw build a customized block to draw a hexagon, which is also named hexagon, and accepts edge length as the only parameter.

Make a Block

Select category Fireblock quickstart cat var en.png in the block palette. Scroll the blocks display area to the bottom, where you'll find a Fireblock quickstart icon make block.png button. Click it to make a new block:

Fireblock make block 1 en.png

1. Select category. Here we select "Pen". The newly made block will be found there in later use.

2. Input name "hexagon", and select block type as Command.

3 This block is of global use. Keep "for all sprites" checked.

As shown below:

Fireblock make block 2 en.png

Press "OK" to enter block editor:

Fireblock make block 3 en.png


We need to specify the edge length of the hexagon, that is, add a parameter edge to the block.

Click the "+" icon at the right of "hexagon", and in the popup parameter dialog, input "edge" as the name:

Fireblock make block 4 en.png

Click "OK", and get:

Fireblock make block 5 en.png

Now is the time to build blocks to draw a hexagon.

Add Block

The drawing of hexagon is simple. It has six edges with the same length. Each angle is 120 degree. Therefore, we just repeat 6 times, each time draw the edge, and turn a degree (180-120=60) to the right.

During the building process, please note that "edge" parameter is draggable. In fact, it is like a "script variable", which be invalid outside the block:

Fireblock make block 6 en.png

Finally get:

Fireblock make block 7 en.png

Please "OK" to close the dialog.

We have made our own block.

Use Customized Block

You can find the newly made "hexagon" block in the "Pen" category. If you need to edit it again, just right click the block, select "edit..." in the popup menu:

Fireblock make block 8 en.png

Now have a try:

Fireblock make block 9 en.png

Click the block group, and the hexagon is drawn on the stage:

Fireblock make block 10 zh.png

Recursive Block

This is an example of using recursion (a block which calls itself) to draw a beautiful hexagon flower:

Fireblock make block 11 en.png

Click the test blocks. Wait some time, and you will be presented with:

Fireblock make block 12 zh.png