Reading serial port data


I have a simple program in an arduino UNO that measures an analog voltage and writes it to the serial port.

what is the simplest way to read this within mblock? I can see the data when i use arduino mode but cannot work out how to use the data. DO I use a communication block? Have tried with no success. Any help greatly appreciated.



Hi gg23,

The communication block cannot be used with the Arduino program in mBlock.
We have plan modify the Arduino program block include adding the serial trasmint function for the new version mBlock in the future.


so there is no way of reading the serial data?



Hi gg23

Currently, there is no program block on mBlock to read serial data from Arduino uno board.


How to read serial data on MegaPi using mBlock?



Please refer to the FAQ 4 in this link about how to use the communication part on mBlock:

You need select the Communication under Extensions when you need use this part. Then choose the board as MegaPi, you can see both the program blocks for MegaPi and Communication.


It’s been nearly a month. Is there any update on this? Will the writeLine block work for mBot/mCore in mBlock 3.38?



Hi tieandjeans,

Adding serial transmit function for Arduino uno program will be achieved in mBlock 3.3.8 and this version is still under testing now.

As for the writeLine block for mBot, I think it already can work with mBot with current version mBlock.


I have been testing with 3.3.8 and an Aduino Nano. I have a program loaded into the Arduino that sends serial data (at 11950bps) In Arduino mode the data is shown in mBlock’s serial monitor.

I would like to use the communication blocks to wait for data and then read a line of data and do something with it.

It is not an option to load the mBlock firmware in the Arduino because that would overwrite the program that reads an RFID scanner and sends the data as serial.

Is this currently possible? If not is it something you plan on implementing soon?



Hi Mike_Dash,

This is currently not possible, the communications blocks cannot be used with the Arduino uno/Nano.
Temporarily, there is no such plan to implementing it. Anyway, I will add this request to customer requirement list for furture assessment.



It’s been more than a year . Any updates on this ?


It works fine with the blocks from the Arduino extension, which has similar blocks for reading and sending serial data.