iotdata, by Data Frontieriot
data
Block coding

Block coding for robotics: where to start

What programming with blocks is, why it works for beginners, what you can do with sequence, condition and repetition, and a path of first programs with the robot arm.

Data Frontier Engineering· Published October 22, 2026

Block coding means building a program by snapping ready-made instructions together instead of typing them. Each block is a real command: "move the servo to 90 degrees", "wait half a second", "if the distance is less than 10 cm". The order the blocks are in is the order the robot follows.

The idea became widely known through Scratch, created at the MIT Media Lab, and today it is in practically every educational robotics kit. It works for a simple reason: it clears away everything that is not logic.

What the blocks clear away

Beginners trip over three things that have nothing to do with the problem they want to solve:

  • Syntax. A missing semicolon, an extra parenthesis, a capital letter in the wrong place, and nothing works. Blocks have no typos.
  • Vocabulary. You have to know that the function is called this, that it takes its parameters in that order. With blocks, the function is right there in view, with blanks to fill in.
  • Structure. Where each loop opens and where it closes. With blocks, what is inside shows up inside.

What is left is what matters: in what order things happen, when each one happens and how many times.

The three ideas behind every program

Every robot program, from the arm on the workbench to the cell on the factory floor, is made of three pieces:

  1. Sequence. One instruction after another. Open the gripper, lower the shoulder, close the gripper, lift.
  2. Condition. Do something only if something is true. If the object is less than 10 cm away, close the gripper.
  3. Repetition. Do it again. Repeat forever: read the joystick and move the servo.

Anyone who masters these three can write practically any behavior. The rest is knowing what each part of the robot can do.

A path of first programs with the arm

The order below goes from the quickest result to the most complete one. Each step adds a new piece.

  1. Beep. One card: sound the buzzer for 200 ms. It checks that the board is receiving the program.
  2. One joint. Move the base servo to 0 degrees, wait, move it to 180 degrees. That is your first sequence.
  3. Back and forth, forever. The same two moves inside "repeat forever".
  4. The joystick is in charge. The base servo follows the X axis of joystick 1. Your first input wired to an output.
  5. All four joints. The two joysticks control the base, shoulder, elbow and gripper.
  6. The robot sees. If the ultrasonic sensor measures less than 10 cm, beep. Your first condition.
  7. The robot decides. If there is an object nearby, close the gripper and raise the shoulder on its own.

And when the blocks are no longer enough?

There comes a time when the student wants to do something the blocks do not offer. That is the time for code. That is why the block coding IDE shows, next to the cards, the code they generate: Python for the ESP32 and C++ for the Arduino Nano. Students see that "repeat forever" becomes a loop and that "if" becomes an if statement, and moving on to text is no longer a leap.

Getting started in the IDE

The block coding IDE opens in the browser, with nothing to install and no account. Choose the board, build the beep program and send it over the USB cable. The next articles in the series explain each part of the arm, one at a time.