Unable to compile mbed prog to activate 328P Slave functions

I recently purchased a Pololu m3pi Robot with mbed Socket (#2151) and a mbed NXP LPC1768 Development Board (#2150) hoping to dust off layers of dust and cobwebs and get back into a little C programming. The amount of documentation and available options is overwhelming. I’m to the point where I would like to create a mbed program that commands a few of the Slave functions programmed into the ATmega328P. I’ve tried trimming the sample Serial Master Program in section 10.b of the Pololu 3pi Robot User’s Guide to just clear and display a character string on the ATmega328P controlled LCD. I tried copying the trimmed down program into the mbed Compiler but apparently the mbed Compiler does not have all the required Library files (i.e. pololu/orangutan.h). I tried to import this from my C:\libpololu-avr directory but the compiler subsequently stated that it could not open the file during compilation.


  1. What Compiler is recommended for programming the LPC1768 as the Master controller over the ATmega328P?
  2. What C Libraries need to installed in the above recommended compiler?
  3. Does the ATmega328P on the Pololu m3pi Robot with mbed Socket (#2151) come with a Slave program (for the LPC1768 Master program) initially installed?
  4. Is there an example Master program for the LPC1768, that is compatible with the above (#3) Slave program, documented or otherwise available for use? If so, where?
  5. Is there a recommended example of an initial LPC1768 Master mini program to demonstrate any of the Slave functions provided by the ATmega328P as a first step? If so, where?

There is so much technical documentation, I’m afraid that I’m having trouble seeing the forest for the trees. Any responses/inputs will be greatly appreciated.


It sounds like you are trying to take 3pi code and use it as mbed code, which is not going to work well. I recommend first looking at the m3pi cookbook and trying the example hello world program there. You should be able to modify it toward your goal.

Let me know if you have additional questions or run into problems.

- Ryan

Thanks for your reply. I continue to filter through all this documentation and I found the following program in the mbed Handbook under Serial:
#include “mbed.h”

Serial device(p9, p10); // tx, rx

int main() {
device.printf(“Hello World\n”);
When I run it, the LCD displays Error Code 0E. Since Section 3a of the m3pi User’s Guide states “To control the base, the mbed communicates serially with the 3pi’s serial slave program at 115,200 bps”, I changed device.baud to 115200. This resulted in an Error Code of 0A. When I changed the device.baud to 9600 (default) the program apparently runs since the 3pi Demo does not; however, the LCD remains blank (shortening the print string doesn’t help).

  1. Where are all the error codes, documented above, defined?
  2. What change(s) do I need to make to the program to get it to run correctly?
  3. Please confirm that the ATmega328P on the Pololu m3pi Robot with mbed Socket (#2151) comes with a Slave program (for the LPC1768 Master program) initially installed?

Found yet another Hello World program after more wandering through the documentation and this one worked (after I figured out how to load the m3pi.h library into the compiler. Forget my earlier reply; however, I’d still like to know where the LCD displayed Error Codes are defined. Thanks for the help. - Yogi

Those probably were not error codes but rather bad command messages. Did the top line of the LCD say “Bad cmd”? 0A and 0E were probably commands that got received but were not valid. You can look at serial slave code to see what it does.

- Ryan