How can I program MBot using Arduino ide instead of MBlock


#1

I would like to program MBot using the Arduino ide, but I don’t to access the libraries. How do I add MBot as an available board in the Arduino ide?
Thanks

jm


mBot Arduino Programming Guide (I/O)
Arduino IDE source code for mBot 2 Shield Board
#2

I’m writing an eBook on that topic that will come out next May(ish). However, the short answer is:

  1. Download the Makeblock-Official library from Github. (link)
  2. Unzip the file into a temporary folder.
  3. Change to the temporary folder and zip the “makeblock” directory.
  4. In the Arduino IDE, click Sketch->Include Library->Add .ZIP library and select the makeblock.zip file you’ve created.

Be sure to install the WinChipAhead driver so that your computer can communicate with the mBot via the USB cable. Note that you cannot upload programs to the mBot via Bluetooth or WiFi.


#3

Hi, I made a very short one and posted in a new thread.


#4

Hey @chuckmcknight,
I look forward to seeing that book! I don’t know how many Makeblock users are out there, but I’d like to think there’s a good market for this type of information. I’d really love to see some of the holes in the MB documentation filled and expanded by a book like this.


#5

Hi @BigAl,

Thanks for the encouragement. The second volume will cover programming with just the base mBot kit although I’m going to do a smarter maze solver as the capstone because that’s a good multi-function application. My thoughts are to do a third volume next year that is advanced projects that will require extra pieces.

I’m also outlining a couple of things to address the Orion and Auriga boards, but they are a little further on in the pipeline. What would be ideal is for someone (else!) to do some sort of technical compendium that goes into great gory detail of the electronic sensors. I’d like to do that myself, but given my work schedule, coupled with my son’s busy schedule (including the FTC Robotics team I was commandeered to coach) and the current book, I won’t get there for a bit.

Oh well, just not enough hours in the day! :wink:

Regards,

Chuck


#6

Hi All,

I am new to mBot and really loving it!

However- I am stuck on one thing: Can someone please tell me which board I should select within the Arduino IDE for mBot?

I am using the Arduino IDE launched from mBlock, and it works great with the “Upload to Arduino” button.

However, if I select “Edit with Arduino IDE”, it launches the IDE with “Arduino Yun” board selected, and when I upload I get the error:

avrdude: butterfly_recv(): programmer is not responding
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

Should I be using “Upload to Programmer” instead? If so, which programmer should I select?

Thank you,
Ian


#7

I use the Arduino/Genuino board in the boards menu. :slight_smile:


#8

Thanks for info provided in this thread. Have 2 additional Qs:

  • I already installed the mBlock 3.4.4 and it works (when mBot is connected using USB it appears as COM4 in the serial menu, can upload programs made with Scratch do the bot and they work ok - however the “built in” Arduino IDE doesn’t work which why I installed the original Ardunio IDE 1.8.0) Did I have to install the USB driver that comes with the Arduino IDE? I switched that option off, because I was afraid of messing up what already works.
  • How to connect & upload software to mBot from Ardunio IDE? I am totally new to Ardunio platform, so have no prior experience to help me.

#9

You will need to install the USB driver because the mCore board does not use FTDI to support physical serial connections. If you are using macOS (Sierra), you will need the beta driver mentioned in another thread (link) or you will need to buy a 3rd party driver from this link.

Once you are connected to the mBot, you would do the compile/upload from the Arduino IDE just as you would for any other Arduino-based board.


#10

I am on Windows 10. But your advice is helpful, because my daughter has a Mac and somehow mBlock doesn’t connect with the mBot on her computer, so everything she creates in mBlock has to be sent over to my machine for upload to the bot. Will try the driver you recommend.

As for my machine basically Arduino IDE 1.8.0 worked out of the box even though I did unselect the “USB Drviver” option on install.


#11

I’m having the same issue so I just tried that, but still not working, any other suggestions.


#12

In the Arduino IDE:

  1. Select Arduino/Genuino
  2. Make sure you have selected the correct serial port corresponding to the mBot (not sure what that is on your system).
  3. If you bring up the Serial Monitor you may have to fiddle with the bit rates. I was testing a gyro today and kept having to switch back and forth between 9600 baud and 115200 baud. Not completely sure why (that’s a dive down a rabbit hole that I’ll save for a different day).

#13

thanks, i’ll try that I didn’t see Genuino listed in any documentation, so I’ll try that.


#14

What version of Arduino are you using? I’m using the 1.8.x version.


#15

I have continously problems with compiling from arduino ide. it doesnt recognize or misses stuff while library is included

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:18: error: ‘A10’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

              ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:23: error: ‘A15’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                   ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:33: error: ‘A9’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                             ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:37: error: ‘A14’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                                 ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:47: error: ‘A8’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                                           ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:51: error: ‘A13’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                                               ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:83:65: error: ‘A12’ was not declared in this scope

{ 16, 17 }, { A10, A15 }, {  A9, A14 }, {  A8, A13 }, {  A7, A12 }, 

                                                             ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:85:9: error: ‘A11’ was not declared in this scope

{ A6,A11 }, {  NC,  A2 }, {  NC,  A3 }, {  NC,  A0 }, {  NC,  A1 },

     ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:4:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeBaseBoard.h:73:21: error: redefinition of ‘MePort_Sig mePort [17]’

MePort_Sig mePort[17] =

                 ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:80:13: note: ‘MePort_Sig mePort [17]’ previously defined here

MePort_Sig mePort[17] =

         ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:4:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeBaseBoard.h:75:24: error: ‘A8’ was not declared in this scope

{ NC, NC }, { 11, A8 }, { 13, A11 }, { A10, A9 }, { 1, 0 },

                    ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeBaseBoard.h:75:36: error: ‘A11’ was not declared in this scope

{ NC, NC }, { 11, A8 }, { 13, A11 }, { A10, A9 }, { 1, 0 },

                                ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeBaseBoard.h:75:45: error: ‘A10’ was not declared in this scope

{ NC, NC }, { 11, A8 }, { 13, A11 }, { A10, A9 }, { 1, 0 },

                                         ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeBaseBoard.h:75:50: error: ‘A9’ was not declared in this scope

{ NC, NC }, { 11, A8 }, { 13, A11 }, { A10, A9 }, { 1, 0 },

                                              ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:28:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMCore.h:77:21: error: redefinition of ‘MePort_Sig mePort [17]’

MePort_Sig mePort[17] =

                 ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:80:13: note: ‘MePort_Sig mePort [17]’ previously defined here

MePort_Sig mePort[17] =

         ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:29:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:89:22: error: redefinition of ‘MePort_Sig mePort [17]’

MePort_Sig mePort[17] =

                  ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:80:13: note: ‘MePort_Sig mePort [17]’ previously defined here

MePort_Sig mePort[17] =

         ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:29:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:19: error: ‘A8’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

               ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:24: error: ‘A9’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

                    ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:32: error: ‘A10’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

                            ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:37: error: ‘A11’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

                                 ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:46: error: ‘A13’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

                                          ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:92:51: error: ‘A12’ was not declared in this scope

{ 16, 17 }, {  A8,  A9 }, { A10, A11 }, { A13, A12 }, {  NC,  NC }, 

                                               ^

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeMegaPi.h:97:33: error: redefinition of ‘Encoder_port_type encoder_Port [6]’

Encoder_port_type encoder_Port[6] =

                             ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:89:19: note: ‘Encoder_port_type encoder_Port [6]’ previously defined here

Encoder_port_type encoder_Port[6] =

               ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:33:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeOrion.h:74:21: error: redefinition of ‘MePort_Sig mePort [17]’

MePort_Sig mePort[17] =

                 ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:80:13: note: ‘MePort_Sig mePort [17]’ previously defined here

MePort_Sig mePort[17] =

         ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:42:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeShield.h:72:21: error: redefinition of ‘MePort_Sig mePort [17]’

MePort_Sig mePort[17] =

                 ^

In file included from C:\Users\u00b321\Desktop\sketch_apr01a\sketch_apr01a.ino:3:0:

C:\Users\u00b321\Documents\Arduino\libraries\makeblock\src/MeAuriga.h:80:13: note: ‘MePort_Sig mePort [17]’ previously defined here

MePort_Sig mePort[17] =

         ^

exit status 1
Error compiling for board Arduino/Genuino Uno.


#16

Can you post your code?

How current is your Makeblock libraries source?


#17