texto bitbloq

What´s in a name?

Today we´re going to learn how the blocks of the Text tab work.


The text tab blocks will enable you to display messages via the serial port or the LCD screen. From communicating with your robots or machines and the world, to displaying the value of a variable or sensor. Let´s learn how they work!

For today´s examples, you will need:

  • 1 x ZumBloq LED
  • 1 x ZumBloq buzzer
  • 1 x ZumBloq push-button
  • 1 x ZumBloq LCD
  • A ZUM BT 328 controller board or one compatible with Arduino UNO
  • A USB cable

The “…” block


This block works is a very similar way to the number block that we saw in the maths tab. Only in this case, instead of writing a numerical value, we can write a word or text. In programming, a string is a chain of characters, which is the same as a word or phrase.

Example using the “…” block

Writing a phrase/string and checking that the program displays it on the LCD screen

The first thing you need to do is connect the LCD screen to your board. If you don´t remember how to do it, take a look at this diagram:


To write one phrase per screen, the example would look like this:


As you can see, we have declared the variable phrase (frase), which we have assigned the text “hello robonauts”(hola robonautas), and then we have displayed the variable on the LCD.

NB: Remember that the LCD screen cannot display special characters or letters with accents.

The to… append text block


This block allows you to add text to a ready-made text or string. When we join two phrases or strings into one chain of characters, we say that we are concatenating.

Example using the to… append text block

Creating two phrases and concatenating the first to the second


In this example we have created two different phrases. Then we have added (or concatenated) the text of variable b to the phrase of variable a, so that when variable a is displayed on the LCD screen, the result will be: “I love robotics”

Concatenating might seem like a simple operation and not all that useful, however, it is used in a great many programs to improve the handling of and access to information.

The create text with… block


As with the previous one, this block allows us to join or concatenate various phrases or strings. Only this time we can also combine numerical variables, as well as concatenating various phrases instead of just two.  To do this, remember to click on the star in order to be able to add all the new elements you need.


Example using the create text with block

Creating a phrase by concatenating two strings


You will see that this example is very similar to the previous one where we created two variables with text, and a third variable where we concatenated the previous variables by making a new phrase: “My name is Anita”.

The length block


This block returns the length of a string. In other words, it measures our phrase by including the spaces between the words. This can be useful in some cases, for example, when we want to make sure that a string is within the allowed number of characters for one message.

Example using the length block

Making a program light up an LED on pressing the button, when the given number of text characters is less than 140


In this example, we are using the length block to find out how many characters our phrase has. If it has less than 140 characters and we press the button, the LED will light up, otherwise it will remain off.

The text = block


This block compares all the characters of two strings one by one, and it checks whether they match (disregarding upper and lower case). This enables us to check if two characters, words or phrases are identical. When you use variables with text, it is important that you use this comparison block and not the logic tab. Although it may seem the same, comparing a number to a phrase makes a big difference to your board, so don´t forget!

Example using the text = block

Making a program that compares two strings and if they are identical, that makes the buzzer sound 3 times for 100 ms each time. If they are different, it sounds once for 1000 ms.


If the two phrases are the same, the buzzer will sound 3 times. Try changing one of the phrases and you will see that the text = block checks that the phrases are not the same and the condition is not met. So the buzzer will only sound once.

The crop… from …to block


This block is for cropping a string. This is very useful when using Bluetooth as it means that you only need to send all the data once, cropping it as required.

Example using the crop… from …to block

Displaying a selected part of a text variable on the LCD


This example shows how a phrase can be cropped by only displaying the part that we are interested in, which in the case, is the second part of the phrase in the text variable “This is part 2″.

The block of the text tab will be very handy when you want a fun and simple way for your inventions or robots to communicate with the world around them. Experiment and play around with it to display different messages, depending on different conditions. No doubt you´ll already have a ton of ideas!