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

Fork of m3pi by Chris Styles

Revision:
7:9b128cebb3c2
Parent:
5:09fb0636207b
Child:
8:4b7d6ea9b35b
diff -r 62ee1486ecb9 -r 9b128cebb3c2 m3pi.h
--- a/m3pi.h	Wed Nov 10 09:01:21 2010 +0000
+++ b/m3pi.h	Fri Mar 25 15:44:52 2011 +0000
@@ -51,10 +51,6 @@
 
 
 
-
-
-
-
 /** m3pi control class
  *
  * Example:
@@ -64,7 +60,7 @@
    #include "mbed.h"
    #include "m3pi.h"
 
-   m3pi pi(p8,p9,p10);
+   m3pi pi;
 
    int main() {
 
@@ -91,13 +87,20 @@
 
     /** Create the m3pi object connected to the default pins
      *
-     * @param nrst GPIO pin used for reset. Default is p8
+     * @param nrst GPIO pin used for reset. Default is p23
      * @param tx Serial transmit pin. Default is p9
      * @param rx Serial receive pin. Default is p10
      */
+    m3pi();
+
+
+    /** Create the m3pi object connected to the default pins
+     *
+     */
     m3pi(PinName nrst, PinName tx, PinName rx);
 
 
+
     /** Force a hardware reset of the 3pi
      */
     void reset (void);
@@ -133,7 +136,6 @@
     void left (float speed);
 
     /** Drive left motor forward and right motor backwards at the same speed to turn on the spot
-     *
      * @param speed A normalised number 0 - 1.0 represents the full range.
      */
     void right (float speed);
@@ -151,18 +153,19 @@
 
     /** Read the battery voltage on the 3pi
      * @returns battery voltage as a float
-     *
      */
     float battery(void);
 
     /** Read the position of the detected line
      * @returns position as A normalised number -1.0 - 1.0 represents the full range.
-     *
+     *  -1.0 means line is on the left, or the line has been lost
+     *   0.0 means the line is in the middle
+     *   1.0 means the line is on the right
      */
     float line_position (void);
 
 
-    /** Calibrate the sensors. This turns the robot left then right, loking for a line
+    /** Calibrate the sensors. This turns the robot left then right, looking for a line
      *
      */
     char sensor_auto_calibrate (void);
@@ -187,8 +190,6 @@
      */
     void leds(int val);
 
-
-
     /** Locate the cursor on the 8x2 LCD
      *
      * @param x The horizontal position, from 0 to 7
@@ -225,7 +226,6 @@
 
     DigitalOut _nrst;
     Serial _ser;
-    BusOut _leds;
     
     void motor (int motor, float speed);
     virtual int _putc(int c);