Block-Based Programming – What is Ardublock

This tutorial is the first of a series of three, which intend to present the Ardublock block-based programming environment.

This first part will present what is block-based programming and give a brief description of some of these environments that are available. The second part will teach how is possible to edit the Ardublock file using Eclipse and how to add the Ardublock plugin to Arduino IDE. Finally, in the third part, is shown how to create programming blocks in Ardublock.

Text-based vs. Block-based programming

While text-based programming consists of code typed on a keyboard by hand and saved into files, block-based programming consists of drag-and-drop blocks of instructions. The main goal of using block-based programming is to joint multiple blocks, as it was a puzzle, in order to create a functional algorithm.
With block-based programming, it is possible not to focus on unnecessary details from text-based programming (like colons), which is not of much relevance for beginners, but to focus on the logic to solve the problem and on the structure of the algorithm.

Weintrop and Wilensky [1] presented a comparative study about how text-based and block-based programming will affect learners. During five weeks, two classes of students were analyzed in an introductory high-school programming class. Although, students of both programming methods showed improvements at coding, the ones that learned using block-based programming showed higher learning scores and more interest in keep having more computer science modules in the future.

Block-based environments

In this section, four block-based programming environments will be briefly described: Scratch, Minibloq, Ardublock, and Arduviz.

Scratch

Scratch [2] was developed at MIT Media Laboratory targeting a younger audience, but some universities have been using it to introduce novices to programming [3].

A project on Scratch contains a fixed stage (background) and several movable sprites that can be controlled by dragging and dropping blocks. These blocks are divided into subcategories and each subcategory has a corresponding colour, which increases the ease of construction and understanding of the algorithm being built. It is possible to create online projects (using the browser) and offline projects (installing Scratch on the computer).

Although Scratch provides a window that enables you to see the result of the developed algorithm, it does not have a real-time window to see the block-based code translated to the text-based language.

Minibloq

Minibloq is an open-source block-based programming environment that can be used for Arduino and other platforms. Programming on Minibloq consists of the combination of drag-and-drop blocks for the elaboration of an algorithm, similar to Scratch. After logically combining the blocks to perform a certain task, the algorithm can be compiled into C++ code and sent to a device.

Minibloq is a stand-alone IDE [4], i.e., it is not aggregated to any IDE like other block-based programming environments that will be analyzed in the following paragraphs. An advantage of Minibloq is the possibility of adding new blocks with different functionalities according to the needs required. Minibloq has a real-time window that enables to see the text-based code being generated while the block-based code is being created by grouping blocks. If blocks are incorrectly/incompletely connected then the text-based language will be marked with red colour in the real-time window. The real-time code generation provides a greater perception between blocks and the text-based code they generate.

Unfortunately, Minibloq hasn’t been updated for a few years.

Ardublock

Unlike Minibloq (which is a stand-alone IDE), the Ardulock is an add-on to Arduino IDE that explores the block programming thread. This add-on has a vast library of available blocks supporting many Arduino features and standard hardware like ultrasonic sensors and servos [4].

After finishing the block-based algorithm with a sequence of blocks it is possible to upload it to the platform of your choice, you only need to press one button and the Ardublock will convert the blocks to textual language, put the text-based code on Arduino IDE and automatically do the upload to the platform. Since the Ardublock is linked with Arduino IDE, every platform available in the IDE can be used by the Ardublock. Ardublock is simple to use and intuitive, unfortunately, it does not have a real-time window, where it is possible to see the text-based code being generated while the blocks are being dragged and connected, but it is possible to obtain the final text-based algorithm, which is very positive.

Has an advantage, if needed and with basic knowledge of XML and Java, Ardublock allows for the development of new blocks and this is the feature that will be explored in the third part of the tutorials in this series.

Arduviz

The students of the Institut Teknologi Bandung, from Indonesia, made research and developed a new visual programming environment to create code for Arduino. Their goal was to connect in a unique application the strengths of Ardublock (which has many blocks to use with Arduino platforms), and the strengths of MiniBloq (which can generate real-time code).

To make the Arduviz an intuitive program and to easily correlate the block and text-based languages, the authors gave all the blocks the same name as the equivalent function in Arduino [4]. Furthermore, the blocks were divided into two categories: value block and statement block. The value block returns a value and is used for variables, constants, and functions that return value. The statement block rather than returns a value can be stacked vertically to form an algorithm. Even so exists another block type that can only contain statement blocks, used for setup() and loop() procedures, and anything outside that procedure. There is some aspect of this IDE that can be improved, like syntax highlighter to make generated code easier to read and understand. Also, the support of more Arduino features like I2C and SPI communication.

Conclusion

In this post, it was presented that beginners who learn to code using block-based environments can get higher learning scores and develops a greater interest in continuing to learn how to code. There are many environments that base their programming on blocks, but the one that will be analyzed in detail in the next tutorials is the Ardublock plugin. In the second part of this series of tutorials an analysis of how the plugin can be edited and how it can be added to the Arduino IDE will be performed.

References

[1] D. Weintrop and U. Wilensky, “Comparing block-based and text-based programming in high school computer science classrooms”, ACMTransactions on Computing Education (TOCE), vol. 18, no. 1, pp. 1–25,2017.

[2] M. Resnick, J. Maloney, A. Monroy-Hernández, N. Rusk, E. Eastmond,K. Brennan, A. Millner, E. Rosenbaum, J. Silver, B. Silverman, et al., “Scratch: programming for all, ”Communications of the ACM, vol. 52, no. 11, pp. 60–67, 2009.

[3] D. Topalli and N. E. Cagiltay, “Improving programming skills in engineering education through problem-based game projects with scratch, ”Computers & Education, vol. 120, pp. 64–74, 2018.

[4] A. B. Pratomo and R. S. Perdana, “Arduviz, a visual programming ide for arduino,” in Data and Software Engineering (ICoDSE), 2017 International Conference on, pp. 1–6, IEEE, 2017.

Leave a Reply

Your email address will not be published. Required fields are marked *