You are viewing an older revision! See the latest version

m3pi

Table of Contents

  1. Hello world
  2. Hardware

Hello world

Before you start

Before you run the hello world program, you must ensure that the Pololu 3pi robot has been reprogrammed to accept commands from the mbed Microcontroller. It is the combination of the mbed hardware and the new firmware on the 3pi that makes it an m3pi!

See Preparing your m3pi for more details

Import program

00001 #include "mbed.h"
00002 #include "m3pi.h"
00003 
00004 m3pi m3pi;
00005 
00006 int main() {
00007 
00008     m3pi.locate(0,1);
00009     m3pi.printf("LO World");
00010 
00011     wait (2.0);
00012 
00013     m3pi.forward(0.5); // Forward half speed
00014     wait (0.5);        // wait half a second
00015     m3pi.left(0.5);    // Turn left at half speed
00016     wait (0.5);        // wait half a second
00017     m3pi.backward(0.5);// Backward at half speed 
00018     wait (0.5);        // wait half a second
00019     m3pi.right(0.5);   // Turn right at half speed
00020     wait (0.5);        // wait half a second
00021 
00022     m3pi.stop();       
00023 }

Hardware

There is very little connectivity needed needed to make the m3pi work, and it is all taken care of by the m3pi PCB. The basic connections are :

mbed3pi Expansion header
GroundGround
VinVcc
p8nRST
p9 (from mbed)RXD (to the 3pi)
p10 (to te 3pi)TXD (from the 3pi)

All wikipages