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

Dependencies:   btbee

Dependents:   configure_btbee m3pi_btTest Test_SlowDown TurnAround ... more

Fork of m3pi by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
ngoldin
Date:
Fri May 17 14:04:12 2013 +0000
Parent:
10:f89d2a3a9ed2
Child:
12:78fd82b3fb09
Commit message:
slowstop

Changed in this revision

m3pi_ng.cpp Show annotated file Show diff for this revision Revisions of this file
m3pi_ng.h Show annotated file Show diff for this revision Revisions of this file
--- a/m3pi_ng.cpp	Tue May 14 11:05:33 2013 +0000
+++ b/m3pi_ng.cpp	Fri May 17 14:04:12 2013 +0000
@@ -73,6 +73,19 @@
     }
 }
 
+void m3pi::slowstop (float speed, float waittime, int steps) {  
+  for (int i=2; i<steps ; i++)
+    {
+     float slowed;
+      slowed=speed*float(steps-i)/float(steps);    
+     motor(0,slowed);
+     motor(1,slowed);
+     wait(waittime);
+    }
+     motor(0,0);
+     motor(1,0);    
+}
+
 void m3pi::reset () {
     _nrst = 0;
     wait (0.01);
--- a/m3pi_ng.h	Tue May 14 11:05:33 2013 +0000
+++ b/m3pi_ng.h	Fri May 17 14:04:12 2013 +0000
@@ -119,6 +119,8 @@
      */
     void calibrated_sensor (int *);
    
+    void slowstop (float speed, float waittime, int steps); 
+   
     /** Play music using the buzzer
      */
     void playtune (char* text, int length);