The blocks. Structure and actions

 Understanding Blocks

Blocks are the building pieces of every program in Clu-Blocks Pro.

Just like you can build a house using different LEGO pieces, you can build a program by connecting different blocks together.

Each block has a job to do.

Some blocks:

  • Turn on an LED
  • Read a sensor
  • Display information
  • Perform calculations
  • Make decisions
  • Control motors

When blocks are connected together, they create the instructions that the D1 R32 follows.

Most programs run from top to bottom, following the order of the connected blocks.


Parts of a Block

[INSERT IMAGE HERE: Structure of a Block]

A typical Clu-Blocks Pro block contains several important parts.

PartPurpose
Block NameTells you what the block does.
ParametersInformation that the block needs to work.
Input ConnectionsPlaces where you can connect values, variables, or other blocks.
Block ConnectionsAllow blocks to snap together.
Drop-down MenuLets you choose between different options.
Configuration IconOpens additional settings for some blocks.

Not every block contains all of these parts. The layout depends on what the block is designed to do.


Getting Help

Not sure what a block does?

Simply place your mouse pointer over the block and wait a moment.

A small help box may appear explaining the purpose of the block.

[INSERT IMAGE HERE: Block Help Tooltip]

This is one of the fastest ways to learn new blocks while programming.


Block Names

The block name tells you the block's main purpose.

Examples include:

Print

If

Servo

Digital Input

By reading the name, you can usually understand what the block is designed to do.


Parameters

Many blocks need extra information before they can work.

This information is called a parameter.

For example:

Delay 5 Seconds

The parameter is:

5 Seconds

Another example:

Print "Hello"

The parameter is:

"Hello"

Parameters allow the same block to be used in many different ways.


Right-Click Menu

When you right-click a block, you can access several useful options.

[INSERT IMAGE HERE: Block Context Menu]

OptionWhat It Does
DuplicateMakes a copy of the block.
Add CommentAdds notes to explain your code.
Collapse BlockMakes a block smaller.
Expand BlockRestores the block to full size.
Disable BlockTemporarily turns the block off.
Enable BlockTurns a disabled block back on.
Delete BlockRemoves the block.

These tools make larger programs much easier to organize and edit.


Duplicating Blocks

If you need another copy of the same block, use:

Duplicate

This creates an exact copy, including all settings and values.

[INSERT IMAGE HERE: Duplicate Block]

This is often faster than creating a new block from scratch.


Adding Comments

Comments are notes that explain your program.

Examples:

Read Temperature Sensor

Turn On Warning LED

Display Value on LCD

Comments help you and other people understand what the code is doing.

Comments help humans understand code. They do not affect how the program runs.


Collapse and Expand

As programs become larger, they can take up a lot of workspace.

The Collapse option makes a block smaller.

The Expand option restores it to normal size.

[INSERT IMAGE HERE: Collapse and Expand]

This is useful for keeping projects neat and organized.


Disable and Enable

Sometimes you want to test a program without deleting part of it.

Use:

Disable Block

to temporarily turn a block off.

Later, you can choose:

Enable Block

to turn it back on.

This is very useful when debugging and testing programs.


Deleting Blocks

Use Delete Block when you no longer need a block.

[INSERT IMAGE HERE: Delete Block]

If you make a mistake, use:

Ctrl + Z

or

Undo

to restore it.


Configuring Blocks

Some blocks can be expanded with additional options.

These blocks contain a small configuration icon.

[INSERT IMAGE HERE: Configuration Icon]

One common example is the If block.

A simple If block can be expanded to include:

IF

ELSE IF

ELSE

Example:

IF Temperature is High

   → Turn On Fan

ELSE IF Temperature is Medium

   → Reduce Fan Speed

ELSE

   → Turn Off Fan

This allows your programs to make more detailed decisions.


Using Values and Variables in Blocks

Many blocks require information before they can perform their task.

For example:

  • Which pin to use
  • Which number to compare
  • What text to display
  • Which variable to read

These values can be connected directly into a block.

[INSERT IMAGE HERE: Embedded Parameters]

Only compatible values can be connected together.

Just like puzzle pieces, the shapes help show what can fit where.


Working with Variables

Variables are one of the most important tools in programming.

A variable stores information that can be used later.

Think of a variable as a labeled storage box.

Example:

Score = 10

The variable is:

Score

The value stored inside is:

10


Types of Variables

Different variables can store different kinds of information.

TypeWhat It StoresExample
IntWhole numbers25
FloatDecimal numbers23.5
BooleanTRUE or FALSE valuesTRUE
StringText"Clu-Bot"

Integer (Int)

Stores whole numbers.

Examples:

0

15

100

Common uses:

  • Scores
  • Counters
  • Sensor thresholds

Float

Stores numbers with decimal places.

Examples:

3.14

23.5

98.6

Common uses:

  • Temperature
  • Distance
  • Measurements

Boolean

Stores only two possible values:

TRUE

or

FALSE

Example:

Motion Detected = TRUE

Boolean values are frequently used with Logic and Control blocks.


String

Stores text.

Examples:

"Hello"

"Clu-Bot"

"Temperature"

Strings are used for messages, labels, and display text.


Quick Reference

TermMeaning
BlockA piece of code with a specific job.
Block NameDescribes what the block does.
ParameterInformation given to a block.
DuplicateCreates a copy of a block.
CommentA note explaining the code.
Collapse / ExpandMakes blocks smaller or larger.
Disable / EnableTurns a block off or on temporarily.
DeleteRemoves a block.
VariableStores information.
IntWhole number.
FloatDecimal number.
BooleanTRUE or FALSE.
StringText.

 Key Takeaway

Blocks are the building pieces of every Clu-Blocks program. By connecting blocks, adding values, and using variables, you can create programs that read sensors, make decisions, control devices, and interact with the real world.