Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: btbee
Fork of m3pi_ng by
Revision 11:7bfb33432791, committed 2013-05-17
- 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);
