Getting started with Arduino C coding with mBot Ranger


#1

Hi all.

I bought my son the mBot Ranger for Christmas with the intent of introducing him to coding, I’ve programmed Arduino boards before for other purposes and felt the Ranger would give him a good set of standard inputs and outputs.

Built the robot and all is working as expected with the mobile App/Bluetooth.

I downloaded mBlock and all good with that too…

I’ve installed Arduino, USB driver, MakeBlockDrive library, selected Arduino/Genuino Mega or Mega 2560 as the board.

All the examples compile and appear to upload as expected (communications LEDs flash), however nothing actually does anything (initial trials with LED and audio outputs). I tried uploading Firmware for Auriga, which works fine!

I’ve replaced the header definition in the examples with #include <MeAuriga.h> as described in the readme, I’ve had a look for hints in the range resources, but no joy. I’ve googled, I’ve searched and feel I’m almost there, but frustratedly not got the final piece of the puzzle.

When I upload the code, the TX and RX LEDs flash, the RX LED goes out and the TX LED stays on.

Can someone please give me some ideas as to how to proceed? I presumably missing something fairly obvious!


#2

I tried some serial output, and that tells me that the code is in fact running, but I’m getting no control of either LEDs or buzzer with the examples in the pack. Not sure what I’m doing wrong, but at least the code is confirmed as running. the examples I’ve been trying are MbotBuzzerTest, MbotBuzzerTest2, and the Led Matrix example - am I simply using the wrong examples, and is there a library manual anywhere?


#3

Anyone at all able to help? Is there support in this forum?

I’ve found the additional Auriga examples buried in the folders (there aren’t many…) and figured out the audio from the Auriga firmware, but it would be helpful if coding this would have been a little better documented. I’m going to have to start now on figuring out the drive motors and not looking forward to it, but I’m sure the firmware will help.

There has to be tech docs somewhere for devs, but I’m unable to find them.


#4

Here are some links that may help you.
https://forum.makeblock.com/t/programming-mbot-with-arduino-c-c-ide/13225

https://github.com/Makeblock-official/Makeblock-Libraries

https://www.youtube.com/watch?v=364_eQUL4X4


#5

Thank you Dr-roboto, I also found Victor Leung’s documents here: mBot Arduino Programming Guide (I/O)

Thankfully, after much head scratching, I already have the basics done and running,

it’s the specifics of the Auriga/Ranger interfaces I can’t find. Chuck McNight and Victor Leung’s examples are all MBOT and the Doxygen code documentation is completely non-board-specific, but thank you for your reply, I appreciate you taking the time.

Maybe I’ll end up having to create my own documentation and release it into the public domain, but it would be helpful if Makeblock support/dev would take the time to document their APIs for each board in some detail.


#6

You will have to do what others have done. All the raw info is in
https://github.com/Makeblock-official/Makeblock-Libraries

and you will have to build you own C documentation.

I had to do the same on the python side.


#7

Thanks again @dr-roboto .

It seems a little odd that every customer has to write their own documentation when the rest of the non-c documentation is actually pretty decent. I guess it must be such a small piece of their actual market.

I was hoping that someone had already some documentation, or there was a wiki somewhere on which we could collaborate since the product is now nearly 3 years old. Ah well - off I go to research and create!


#8

I’ve started a document here: https://docs.google.com/document/d/1EpMWJo9pP2J_pstzXA-XHK8t00Z70SCZYwZ_Kl7VLuw/edit?usp=sharing inspired by Victor Leung’s excellent reference. It’s not finished yet, but it’s a start and hopefully others will collaborate with me to make it better, some day, maybe.

Feel free to share this link across forums etc if you think it’s useful.

#TeachKidsToCode #STEM #NotJustmBlock


#9

One particular piece that I’'m trying to figure out is the on-board 180 optical encoder motor functions. I can set them to run at specified speed (RPM?), change direction, move an absolute or relative distance etc, There are various modes - Direct, PID and PWM, but I can find no documentation on the modes and the functions they offer.

Is Mark Yan around? Does he have any documentation or knowledge he could share in this respect?


#10

Just an additional note that I’ve enabled comments on my document. Input welcome either there or here.


#12

I am now at version 1.4 of this document. If anyone else has anything useful to add to it, please let me know. It will continue to be open under CC BY-NC-ND 4.0 creative commons license.

It could (for example) be extended to include other modules not part of the standard Ranger build.

I’m also keen to find out more about the bluetooth comms - i.e. does it simply operate the same way as the serial port (I notice it shares the same IO pins) - I saw a previous query here: Bluetooth - Send text from PC but there was no useful reply from anyone.


#13

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.