Problem with 'Green Flag' and 'Arrow Keys' programs using mBlock and USB connection


#1

Hello everybody,

I am a robotics tutor at school and recently our school got 10 mBot kits to start robotics classes.
So I just started to work with mBot and mBlock few days ago and I have encountered a very annoying problem.

Me and my students tried to connect mBot to the PC via USB and program it using mBlock. The matter is that we don’t have this USB connection error, which is so widely discussed in this forum - our PCs see and recognize the serial port and are able to connect it. However, when we try to implement some simple programs like ‘go forward at speed 255 for 1 second and then stop’ or something similar using such events as ‘green flag is clicked’ or ‘when … arrow key is pressed’ it works once or couple of times and then it stops responding to mBlock program. mBlock shows that the program is running and the sprite is doing its part of the program (if we add some commands for the sprite), but the robot is not responding to its part of code.

We tried to reset the power button, tried to disconnect and connect USB cable physically and via ‘Connect’ function, and we also tried to reload mBlock itself. Sometimes some of these actions help for a while but then robots stop responding again. I cannot figure out the pattern to follow in order to keep the robots responsive. I have worked with similar Scratch-based robot programming software before and assume that via USB connection it uses interpreter to run the code simultaneously (I may be wrong). So I suspect that there may be a problem with interpreter inside the software, or something that I can’t figure out.

P.S. I did not use ‘Update firmware’ to erase the robot’s built-in program, we tried to run our own programs on top of that. May this be the case of interruption?

I would greatly appreciate your help and advice.


#2

I’ve seen this sort of problem in the past. What I instructed my students to do was to either execute the Upgrade Firmware option or Reset the Default Program option to clear out memory and then reload their program. That seems to fix it although it is something of a mystery to @tec_support and the rest of us why this should fix things. When the avrdude onboard programmer loads a program, it overwrites anything that is already there. It seems like memory is somehow getting stepped on at times but no one has been able to track down why that happens.


#3

Hi,

I am going in the same direction as Chuckmcknight, Upgrade Firmware option or Reset the Default Program. The goal is to clear the memory.

For the problem, it seems that you want to try your program directly in the mBlock software and not in the mBot in standalone mode? To test it directly, he believes he should look a little code. Do you have an exemble?

What version of the software do you use (mblock or scratch)?
What equipment do you use (Chromebook, PC, MAC, Linux)?


#4

Hi angiemelomangie,

The programs with a green flag is clicked or arrow key is pressed, belong to online program.
Before you running the online program, you need to upgrade firmware for the mBot (the firmware is the underlying program which can better support mBlock online program blocks). So every time before you run the online program, please make sure the program inside the mCore is the firmware (instead of factory default program or other uploaded program).
Here is detailed explanation (see FAQ 7) for distinguish the Upgrade Firmware and Reset Default program.
Here I attach the instruction to guide upgrade firmware for the mBot.1. How to Upgrade Firmware for mBot with mBlock 3.4.x.docx.zip (691.4 KB)

Here I tested upgrade firmware for mBot first with mBlock software, then run the following online program, the robot functions normally.Please test with the recommended way have a try.
image

Besides, here is a mBot FAQ list to you for reference.


#5