Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

LineFollower in mbed


Would like to see a full example of line-follower example written in “mbed” code. I see the Library and API, and portion of line-follower code in the m3pi Cookbook. Such a full example would greatly help me and I suspect others. Even without comments would be OK, but with comments would be super.


Hi, Donde.

Googling for m3pi line follower came up with this: http://mbed.org/cookbook/m3pi-RobotRacing

- Ryan


Hi Ryan,
Looked at your suggested site. Only problem: no source files, all bin. Can’t learn anything that way. Looks like ones that bought the m3pi are pretty advanced. I’ll keep at it trying mbed functions that could be useful.


Hi Don.

There are lots of m3pi resource available on the mbed website. Have you tried searching the cookbook for “m3pi”? The third link that shows up is:


In general, you’ll probably get more support for the mbed side of the m3pi from mbed.org since we haven’t really played around with the mbed extensively.

- Ben


I’m figuring that out as I write. You sure went to a lot of effort to develop the expansion board for the mbed and wi-fi stuff. And I commend you for it. I am learning mbed a bit at a time. Not so tough as I first thought. Got PID line follower working fine. Pretty fast! Need to stick in timer function to stop the beast. All the LCD notices as in the 3pi line follower are nice, but learning mbed is more important.

Has Pololu sort of slowed or stopped m3pi software support? As you said, I could probably get more info on mbed site. Your forum has some info, but doesn’t seem very timely, like I’m a year too late. Anyway, I’m not disappointed. Just didn’t understand at first what I was getting into to. And how the two controllers tied together and the limits, once the 3pi becomes slave. But, now I can see the power of the mbed even without connected to the 3pi.

Thanks and good luck,


We didn’t release our version of the m3pi until the August of this year, so we still consider it a relatively new product (you are definitely not “a year too late”). Perhaps some of the older information you see is related to mbed’s initial m3pi prototype?

We are not actively involved in further software support for the m3pi, but then again, we are not actively involved in further software support for the 3pi robot, either. The robot is intended as a user-programmable platform, and to that end we have provided an open-source program that turns the 3pi into a serial slave and an m3pi library for communicating with that slave.

For the most part, we consider the m3pi robot an expansion board for the 3pi robot that makes it easy to add a more powerful high-level controller (the mbed) and wireless capabilities to the 3pi, and that’s how we support it. This was designed in collaboration with mbed, and we expect most of the mbed support and examples to come from the mbed community. I suspect there aren’t a lot of questions on our forum because the mbed forum is the better resource for questions about the mbed part of the m3pi.

Just to be clear, the limits that the 3pi has when it becomes a slave are potentially just limits of our example slave program. The great thing about the 3pi is you can program its microcontroller however you want, so you might be able to overcome some of those limits by customizing the serial slave program. However, limitations involving shared I/O lines, like the 3pi’s red LED being on the 3pi’s serial transmit line or the 3pi’s green LED being on one of the LCD data lines, are not really something you can completely overcome with custom 3pi firmware (the red LED will always be on when the 3pi’s UART module is enabled, and the green LED will always flicker when you write to the LCD). Those are simply the result of trying to cram a lot of features into a robot with a limited number of I/O lines.

- Ben


Thanks Ben for the clarification.

Can I play a tune on m3pi? My last post elaborates. As you say. the mbed forum could help more. OK on the LED problem. I still would like to ask you: what else cannot be done easily on the m3pi platform that could be done on the stock 3pi? The line follower PID works great on the m3pi. Maybe just no music?

Thanks, Don


I think pretty much the only thing you give up on the 3pi when using it as an m3pi is the red user LED, and this is only because the red user LED is on one of the two I/O lines needed for communication between the 3pi and the mbed.

- Ben


Roger on that.



A post was split to a new topic: Communication between Arduino Uno and ARM mbed FRDM-KL25Z