Library for the m3pi robot. This works with a Pololu 3pi robot with the Serial Slave firmware, and exposes and API.

Dependents:   m3pi_USBSerialRPC m3pi_BluetoothRPC m3pi_HelloWorld m3pi_WiiRacing ... more

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Sun Nov 07 09:57:11 2010 +0000
Parent:
3:c38d2f980494
Child:
5:09fb0636207b
Commit message:
Modified reset routine, and code to switch the LEDs off

Changed in this revision

m3pi.cpp Show annotated file Show diff for this revision Revisions of this file
m3pi.h Show annotated file Show diff for this revision Revisions of this file
--- a/m3pi.cpp	Mon Nov 01 23:30:09 2010 +0000
+++ b/m3pi.cpp	Sun Nov 07 09:57:11 2010 +0000
@@ -24,7 +24,8 @@
 #include "mbed.h"
 #include "m3pi.h"
 
-m3pi::m3pi(PinName nrst, PinName tx, PinName rx) :  Stream("m3pi"), _nrst(nrst), _ser(tx, rx)  {
+m3pi::m3pi(PinName nrst, PinName tx, PinName rx) :  Stream("m3pi"), _nrst(nrst), _ser(tx, rx), _leds(p20,p19,p18,p17,p16,p15,p14,p13)  {
+    _leds = 0;
     _ser.baud(115200);
     reset();
 }
@@ -33,6 +34,7 @@
     _nrst = 0;
     wait (0.01);
     _nrst = 1;
+    wait (0.01);
 }
 
 void m3pi::left_motor (float speed) {
--- a/m3pi.h	Mon Nov 01 23:30:09 2010 +0000
+++ b/m3pi.h	Sun Nov 07 09:57:11 2010 +0000
@@ -218,6 +218,8 @@
 
     DigitalOut _nrst;
     Serial _ser;
+    BusOut _leds;
+    
     void motor (int motor, float speed);
     virtual int _putc(int c);
     virtual int _getc();