2024.08.13, ArduBlock 1.0.
You can download the ArduBlock User Manual file 這裡.
1. Introduction of ArduBlock
1.1 What is ArduBlock?
ArduBlock is a visual programming language that lowers the barrier to entry for writing Arduino programs by dragging and dropping building blocks. Even if you have never learned to code, you can easily write powerful Arduino programs. ArduBlock was developed by third-party developer David Li and other creators as a plug-in for the Arduino IDE, and was released in 2014 until October 2017. Its source code is open source for download and use on GitHub. (GitHub download: https://github.com/taweili/ardublock).
ArduBlock was developed with the goal of making it possible for users with no programming background to get started with Arduino quickly. With an intuitive block interface, users can simply drag and splice blocks with different functions to complete the program, each corresponding to a specific function or instruction in Arduino, so that users can easily understand and use it.

This document will provide an in-depth look at this powerful tool so that you can understand its various functions and features.
It mainly has the following functions:
- Control
- Pins
- Test
- Math Operators
- Variables/Constants
- Generic Hardware
- 通訊
- 存取
- 86HMI
- EtherCAT
- MySQL
- Scoop
- Code Blocks
1.2 What is the difference between Scratch and ArduBlock?
Scratch is a visual programming language released in 2006 by the MIT Media Lab’s Lifelong Kindergarten Group to help children learn to code. It is also an open-source project, and users can complete the programming of animations or games by dragging and dropping pre-set building blocks and stacking commands.

However, Scratch is not directly related to Arduino and does not contain Arduino blocks. Although there are enthusiastic players who revamp Scratch and add Arduino blocks to write Arduino programs, such as S4A, S2A, and other unofficial software, these are not still different from ArduBlock.
Wikipedia Introduction: https://en.scratch-wiki.info/
Comparison table of the differences between ArduBlock and Scratch:
ArduBlock | Scratch | |
author | David Li with the players | MIT |
Target group | Arduino players without programming experience | Children who do not have the programming experience. |
publish | Year 2014 | Year 2006 |
Arduino IDE plug-in | 是 | 否 |
Target platform | Arduino | PC |
Creation result | A variety of interactive installations | Animation or games |
source | 開啟 | 開啟 |
Programming methods | Drag and drop | Drag and drop |
1.3 Why use ArduBlock?
ArduBlock is designed specifically for Arduino and comes with a variety of dedicated blocks built-in. Users only need to complete the building block assembly, and the code can be automatically generated, compiled, and uploaded to Arduino in one step. This is friendly for beginners who don’t have a basic experience but want to create. Many teachers use ArduBlock in their teaching to help students quickly understand the basics of Arduino programming.
In summary, ArduBlock is a powerful and easy-to-use visual programming tool for beginners with no programming background. With an intuitive block interface and powerful features, ArduBlock makes it easy for everyone to create their own Arduino projects.
For example, an example of CiA402 control for EtherCAT:

Code generated:

2. Install and launch ArduBlock
2.1 Install the 86Duino IDE
Download the 86duino IDE from https://www.qec.tw/zh/software/

After downloading, please unzip the zip file, no need to install additional software, double-click the 86duino.exe to start.

*Note: If Windows shows the warning message, click Other Information and then click the Continue button.


When the 86Duino Coding IDE 500 is opened, it shown as below.

2.2 Start the ArduBlock
There are two ways to start the ArduBlock
Go to Tools -> ArduBlock or Click the icon as shown below.

Once clicked, the ArduBlock will start.

2.3 Finished, code generation and upload
After the finished ArduBlock programming, use the “Code Generation & Upload” button to generate and upload the code to the QEC master.

Example: CiA402 control example for EtherCAT:

The generated code is as follows:

3. ArduBlock blocks
3.1 Interface introduction

In Blocks Area, the building blocks including the types as below:
- Control
- Pins
- Test
- Math Operators
- Variables/Constants
- Generic Hardware
- 通訊
- 存取
- 86HMI
- EtherCAT
- MySQL
- Scoop
- Code Blocks
3.2 Types of Blocks
ArduBlock building blocks mainly has 3 kinds of functions:
- Starting blocks
- General script building blocks
- Value blocks

3.2.1 Starting blocks

Starting block is the block which main or sub-program starts to execute.
The upper and lower edges are flat and both edges cannot be joined by any other block.
關於 Program 以及 Loop block are both starting block.

Corresponds to the starting point of the main Arduino program:
- Setup
- Executes before the loop
- Execute only once
- Can be empty
- Loop
- Repeat the script inside
Program block

Corresponding to the setup()
以及 loop()
of the Arduino IDE.

- Setup:
When the 86Duino hardware starts to execute sketch code (Note 1), it will first call the setup( ) function, and use it to initialize variables, pin patterns, start announced libraries, etc. The 86Duino hardware will only be executed once after power-on or reset.
- Loop:
The loop() function is executed immediately after a setup() function that performs initialization and sets the initial value of the variable. loop( ). It executes continuously and repeatedly, causing your program to behave and respond; Use it to control your 86Duino hardware action.
Loop block

Only write the program in loop()
, no setup()
content.
Loop 以及 Program block are both starting block, and both generated the setup and loop program, either Loop 或 Program can be used at the same time, otherwise an error will be reported.
3.2.2 General script blocks

The upper and lower edges are concave and convex.
Can joint together with other script blocks.

Script block with input value. (as red circled below).

Some blocks can join other script block internally, such as if block.

3.2.3 Value blocks
There are 5 types:
- integer
- FP, Floating-point number with decimal point.
- string
- characters (a, A, B).
- Boolean (True, False).
The shapes and colors are as follows:

3.3 Introduction for basic blocks

In this chapter, we will focus on 9 types of building blocks:
- Control
- Pins
- Tests
- Math Operators
- Variables/Constants
- Generic Hardware
- 通訊
- 存取
- Scoop (Multitasks)
3.3.1 Control Blocks

The control block will be placed on the top, it is the very basic building block in programming.
These blocks determine the basic program statements, such as if, loop, and so on.

If block

If the test condition is true, will do the then script.
Example: If the digit pin 2 reads HIGH, print the string “Pin 2 is HIGH” in PC Serial Monitor and go next step.

Output code :

if/else block

The if/else is similar to if block, but with else script area than if. We can add a new script in else
based on above example of if block, as follows:

In above example, if the digit pin D2 reads HIGH, print the string “Pin 2 is HIGH” in the PC Serial Monitor and go the next step ; if it is not HIGH, print the string “Pin 2 is LOW” in PC Serial Monitor and go to next step.
While block

Check whether the condition of test is true, do the script in command when it is true, and leave the while block until the condition is not true. If the test condition is not true at the beginning, the script will not be executed.
Example 1:

Example 2: Endless loop. test is always true, the script is always executed in the while. Please not to writing like this unless it is necessary.

do while block

do while will directly execute the script once before judging whether the test condition is true, if the condition is true, then execute the script again, and leave do while if it is not true.
範例:

repeat block

Repeat the script for N times, and N is determined by the input integer value.
Here’s an example of doing 5 times of serial prints “Hello”:

repeat and count block

In addition to repeat the script for N times, you can get how many times you’ve done from the defined name variables. For example, the following example prints 1, 2, 3, 4, 5.

repeat between block

In addition to repeating the script for N times, you can customize the start value(start), end value(stop), and value interval(steps of).

Example 1: Print 1, 2, 3, 4, 5.

Example 2: Print 10, 8, 6, 4, 2, 0, -2.

break block

Put break 於 while 以及 repeat to jump out of the current loop, usually use with if block.
Example 1: Put break 在 repeat and count block and print 1 and 2 only.

Example 2: Put break 於 while block.

delay block

This time-delay block is often used in Arduino, the program keeps waiting and do nothing.
There are two types:
- Delay Millis: Delay N milliseconds, enter 1000 for 1 second.
- Delay Micros: Delay N microseconds, enter 1000 for 1 millisecond.

Milliseconds block

The value of time (in milliseconds) since booting up, it can be printed out with Serial print. Here’s an example:

With Milliseconds block, you can use that to show the message not just waiting.
Below “go through 3 sec …” is the example to print “go through 3 sec …” every 3 seconds.

subroutine block

subroutine block is not a multitasking block, it will do only one time when it is called.
How to Use:
- Place the script inside commands
- Give the script a meaningful name
- Call the script with that meaningful name

Note: When the program is large, the subroutine block can make the program looks more organized and easier to understand, easier for the next person who take over the job or the years later when review the same program (one of the key points is the name must meaningful when you name it).
3.3.2 Pins Blocks

These blocks are to make use of the pins in QEC-M-070T/090T/150T.
The pins include digital IO and analog IO.


digital pin block

關於 digital pin block will read the specified digital IO pin and returns either HIGH or LOW.
There are digital IO pins on different QEC Master, as follows:
1. There are 3 external digital IO pins on QEC-M-043. (marked as red square below)

2. There are 25 external digital IO pins on QEC-M-070T/090T/150T. (marked as red square below)

3. There is no external digital IO pin on QEC-M01.
Example :

set digital output block

The set digital output block is to setup the HIGH or LOW of digital output pin.
1. There are 3 external digital IO pins on QEC-M-043. (marked as red square below)

2. There are 25 external digital IO pins on QEC-M-070T/090T/150T. (marked as red square below)

3. There is no external digital IO pin on QEC-M01.
Example: Blink the LED on D13 pin every 1 second.

analog input block

Read the state of the analog pin N, measure the voltage (between 0 ~ 3.3V), resolution of 0 ~ 4095 (3.3 / 4096 = 0.0008 V = 0.8 mV per div).
The following analog pins can be used from QEC Master:
- No analog IO pin on QEC-M-043.
- There are 6 external analog IO pins on QEC-M-070T/090T/150T.

3. No analog IO pin on QEC-M01.
Analog input read example: Detects the voltage of A0 pin, prints the warning message if the value is too low or too high.

set analog output block

Set analog output block is to use the PWM pin to simulate the analog signal, you can set a number of the Nth PWM pin between 0 ~ 1024, corresponding to 0 % ~ 100% 。
This can only use for the pins with PWM output function, as shown following:

The write example for set analog output: Pin D13 is a digital pin also a PWM pin, we can use that to minor adjust the brightness of the LED.

input pullup block

關於 input pullup block is similar to digital pin block, the difference is that this pin will link to the internal pull-up resistor in the CPU. In other words, if the pin is not connected (tri-state), the read value will be HIGH (because of internal pull-up).
toggle digital pin block

The toggle digital pin block is similar to digital output block, the difference is the state of that digital pin is set in reverse. It will read the state first, reverse it, and then set it back.
For example :
- If the pin is LOW, it will become HIGH after using toggle digital pin block.
- If the pin is HIGH, it will become LOW after using toggle digital pin block.
tone block

The first tone block above can be used to generate Do, Re, Mi…..sounds if that digital pin is connected to a Buzzer.
The second tone block above with extra milliseconds can setup the duration of sound.
Example 1: Pin 8 continuously generates a 440 Hz tone.

Example 3: What if I want to compose a song which needs to use more than two tone blocks?
Wrong :

Correct :

Note: Using delay blocks will freeze the program, using SCoop (Multitask) block is the solution and will explain later in another chapter.
Example 4: Use the built-in buzzer to generate the tone.
The pin 250 is the built-in Buzzer, as shown in the following example

Note: In QEC, when use the build-in Buzzer to generate the tone, the same tone will output to the Audio-out at the same time.
no tone block

關於 no Tone block will immediately stop the sound from the Buzzer pin.
no tone block example: The built-in Buzzer will generate a 440 Hz tone for 500 milliseconds and then stop.

cpuTemperature block

關於 cpuTemperature block can read the temperature of the Vortex86EX2 CPU.
Example of a cpuTemperature block: Prints out the CPU temperature.

3.3.3 Logic blocks

Logic building blocks are used to compare the calculation, integers, floating-point numbers, character strings and characters. In the programs, it is common to use for and , or, not logic calculation.

There are 5 types of value blocks, and the corresponding shapes and colors are as follows:
- integer
- Floating-point number (decimal point).
- string
- character
- Boolean

Numerical comparison blocks

Red circled above in order as below:
- Greater than
- Less than
- Equal to
- Greater than or equal to
- Less than or equal to
- Not equal
Example of numerical comparison:

Boolean comparison blocks

Red circled above in order as below:
- Equal to
- Not equal
Boolean comparison example:

Character comparison blocks

Red circled above in order as below:
- Equal to
- Not equal
Example: If the button pressed by the EtherCAT keypad is A, print the “get A” string.


Strings comparison blocks

Red circled above in order as below:
- The left string is equal to right string
- The left string is not equal to the right string
Note: Uppercase and Lowercase are different.
Example: Judge if the input from get TextInput is “Text” ; and if yes, print “is same”.

Logical calculation – and block

The and block has 2 inputs and 1 output, and the Boolean values for the input/output are shown in the following table:

Example: If “Pin 2 is HIGH” and “Serial has data to receive” are both true, then print “OK”.

Logical calculation – or block

關於 或 block has 2 inputs and 1 output, and the Boolean values of the input/output are shown in the table below:

Example: If either “Pin 2 is HIGH” or “Serial has data to receive” is true, then print “OK”.

Logical calculation – not block

關於 not block has 1 input and 1 output, the Boolean values for the input/output are as follows:

Example: If no data in serial data available, print out the “Empty” string.

Logical calculation – is empty block

is empty block is to judge whether the string is empty or not. Empty string is called True, otherwise false is returned.
Example: Determine whether the TextInput input is an empty string; if yes, print “This is empty string”.

Logical calculation – toInt block

The toInt block is to compare the result after the string convert to number, there are 2 input and 1 output.
- Input 1 : The string to be compared, this string will convert to number.
- Input 2 : Number to be compared
- Output : True / False
Example : Judge whether the TextInput string from HMI is equal to the number of the NumberInput after the text is converted to a number ; and if yes, print “is same”.

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。