Ir remote control reprogram doesn't work in coding


#1

Hi, I tried to program my mBot with mblock using the instructions for intercept the pressure on remote controller keys, but it don’t worked properly.
I say that the IR controller works fine with the mBot A program and my mBot receive the ir signal and it moves in automatic mode.
But when in the mblock program I try to use the instruction IF “ir remote … pressed” in code, the message is apparently not received or processed by program mblock on mBot, so my mBot moves with the key pressure (movement for keys up, down, left, right etc…) but only in automatic/default program (that is the mBot executes the movement on the key pressure, during the mblock program execution, but it don’t execute other instructions into the code block "IF <ir remote … pressed> then ").
I try also to upload the program into arduino CPU via USB, but it don’t work also.
It seems that the automatic remote control program takes over the code instruction flow on mblock program.
What can I do or try to solve this problem?

Thanks

Camillo


#2

Hi ubik_66,

You may paste your program which uploaded to the mBot here.


#3

Hi, yes I upload the program, thanksfrecce.sb2 (74.9 KB)


#4

I think it really does not work in online mode. When you upload it to mBot in Arduino mode, it should work. Did you replace the “When green flag pressed” by “mBot program”?

BTW, the speed setting of 50 is probably too low, motor will not start moving. Try at least 75 or more.


#5

Yes, I tried also with mBot program, I uploaded the program into Arduino CPU, ma it doesn’t work.
The problem is not for speed setting but that the program doesn’t execute the instructions into the conditional code “block IF then…”, the mBot executes only the default movement forward, backward… the condition “is pressed” is not intercepted from the mBot


#6

I have exactly the same problem.
In my case I cannot get the firmware back to the original version, if I upload the factory settings to the robot it does not respon to any IR commands.
HOw can I get to the default firmware?


#7

When I was writing my book on mBlock and the mBot, I encountered this issue and I believe it has to do with over the air lag time. The Arduino-based microcontroller reads at a pretty fast clip, so I put a filtering “if” statement around my individual “if” tests so that whenever a code came through it would be processed. I should note that this was on a program that was uploaded to the mBot, and not “over the air.” I’ll do a test later today to see if that fixes the issue for over-the-air programs and I’ll post the results.


#8

Try resetting the default program (which is different than upgrading the firmware) on the same menu. :slight_smile:


Programming Remote
#9

Hi, do you have tested this fix? But I did not understand very well, what do you mean exactly with “I put a filtering “if” statement around my individual “if” tests so that whenever a code came through it would be processed…”? It’s a coding in Arduino program? Could you post a code sample for this workaround? Thanks


#10

The program in the book was in Scratch/mBlock and essentially did this:

if ((ir remote <up arrow> pressed) or 
    (ir remote <down arrow> pressed) or
    (ir remote <left arrow> pressed) or
    (ir remote <right arrow> pressed))
          Do the processing for the selected commands here
else
    <run forward> at <speed>

The program was for autonomous operation, not necessarily running the mBot from within mBlock.


#11