Reverse import an arduino program into mblock


#1

hi,
weve another robot, that uses the arduino uno as its core, and its came with some arduino sketches codes, is there a tool to import thjis arduino code and see it in mblock? to make it easier to learn for the students?
thanks


#2

I’m assuming the code is in Arduino (.ino) files for the other robot. You can always load that into the embedded Arduino environment in mBlock, but unless the code is in Scratch it will not load into mBlock. mBlock does not to my knowledge perform any translations from Arduino to Scratch, and in any case, you will likely find that the code will not work correctly because it is likely not built using the Makeblock libraries.

Regards,

Chuck


#3

thanks chuck. yes, this other robot uses straight arduino, and my students (and I) arent up to task with straight up mod c with arduino straight up. looks like ill be learning to make sketches with arduin 3.x.x!

do you think i could create code in mblock and upload it to this robot, its an arduino uno original board in it? thanks again!


#4

mBlock embeds the Arduino IDE in its installation, so you should can to do straight-up Arduino sketches and upload them to an Arduino Uno (if you’ve selected the correct board). However, I’m not sure that there is any real benefit in doing it in that fashion. Just my tuppence. :slight_smile:

I should mention that I’m starting to work on the second volume in a series of books for the mBot that is focused on using the Arduino IDE to work with the mBot. I’m targeting sometime next Spring (May/June) for release. The first volume (link) is focused on mBlock and the mBot if you’d like to take a look.


#5

thats great, as i bought your ebook a frew weeks ago and love it! its a little different than the plan ive got for my class, were going to build, prograsm remote control, follow the line, obstacle… the book its a little too much math for my group, whereas in your book you build block, and calc the turns and create turn blocks, etc… but its great, as im going to adopt my plan next semester more along your book… baby steps, building up, building blocks, turns, motion, and then the line, avoid, remote, etc… mblock needs to upg. with backpacks, copy/paste, other robot control blocks, etc…! cant wait for next book!


#6

Thanks for buying the book, I’m sure the kids appreciate it! :slight_smile:

While I can see how some of the formulae for calculating movement might appear to be a bit hairy depending on the age group, I’m not sure how else to convey that information. When I’m teaching a class using the book materials, I explain that in Scratch each arithmetic, comparison, or logical operation should be visualized as being within a set of parentheses. The kids (ages 11-15) seemed to pick up on that very rapidly and it hasn’t seemed to be a big deal for them. However, each child is different so perhaps there is a better approach.

I’m not sure why Makeblock isn’t using all of the Scratch features, e.g., backpacks, but I have heard rumors that they are working on a plugin for the online Scratch editor. Perhaps that will solve the cross-platform issues for Linux as well. :slight_smile:


#7

If you are using mBlock for other robots/Arduino boards, you may want to have a look at the extension system, which allows you to create new blocks for your Arduino based robots. All you need to do is to tell mBlock how to generate the Arduino code for that hardware. Here’s the documentation:


#8

Nice one, thank you bigeyex.


#9

Heh, I bought that book. No wonder your name looked familiar.


#10

Thanks for helping the kids!

I hope you have found it to be useful. :slight_smile: