Led Blinking Tutorial With mblock and Arduino

In the first lesson of the arduino coding tutorials with mBlock, we will examine the circuit diagram and mblock codes for led blinking with mblock and arduino.

In this tutorial;

  • General information about Mblock program,
  • Arduino programming with mblock,
  • Arduino LED connection,
  • Led blinking mblock codes,
  • Uploading mblock codes on an arduino card.

What is mBlock software?

mBlock program is a tool we will use to do coding with drag and drop code blocks. We can program arduino cards, mbot, ultimate and other many cards with mBlock software.

What is mBlock software?

Mblock is a freeware software. You can download mblock following link: https://www.mblock.cc/en-us/download/

How to set arduino LED blinking circuit diagram

LEDs are one of the most used circuit elements of arduino and many robotic projects. There are two legs on LEDs.
The long leg of the leds is the anode (+) pole and the short leg is the cathode (-) pole.

We will connect the anode leg to one of the arduino 2-13 digital pins and connect the cathode leg to the GND (ground) pin on arduino.

We use a 220 ohm resistor in the circuit to prevent failure of the leds.

Now let’s set the arduino led blinking circuit in the picture.

Mblock and Arduino Led Blink Circuit Diagram

How to select arduino model and arduino port on mblock software.

In order to install the mblock codes on the arduino card, we must select the arduino model and serial port correctly.

Let’s click ‘Cards den in the menu and select the arduino model that we will use.
We choose the model arduino uno for this tutorial.

The next step is to select the serial port to which we connect the arduino on computer. If the serial port selection is wrong, there will be problems uploading the mblock codes into the arduino card.

For serial port selection, click ‘Connect’, and ‘Serial Port’ on top menu. Generally COM1 is active. After connecting the arduino to the computer, we need to select the port other than COM1. If the number of ports is greater, you can remove the arduino from the computer and check the list of which port numbers are missing.

Mblock-Arduino Model and Serial Port Selection

Led blinking codes with mblock and arduino

We will use the codes in the Robots tab, so click the Robots title.
Now prepare the mblock codes in the picture.

Arduino Led Blinking Mblock Code

Let’s explain mblock codes;

Remember the circuit diagram, we connected the long leg of the LED to Arduino pin 2. So I have to write the number 2 in this code.

The “HIGH” value of any digital pin is to send an electrical signal to that pin. Conversely, making any digital pin “LOW” means disconnecting the electrical signal from that pin.

With 1 second code, the LED should be continuously blinkin at 1 second delay.


Uploading mblock codes on arduino card

Last step we will upload mblock led blinking codes to aruino card.

Now click on the right mouse button above the ‘Arduino Program’ code at the top of the code blocks and select ‘upload to arduino’ from the menu.

Or you can select the arduino mode from the ‘Edit’ menu for another method.

Now click Upload to Arduino button on arduino mode.
When the upload process is finished, you will see that LED is continuous blinking.

Arduino and mblok Led Blinking Tutorial


In this lesson, we learned the answers of this questions.

How to connection LEDs on arduino card?
How to prepare mblock led blinkin codes?
How to select arduino model and serial port in mblock software?
How to upload mblock codes to aruino card?

You can comment if you like the tutorial.
You can follow us social media.

Leave a Reply

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