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.
Revision 0:e6d2aeb6f9cd, committed 2016-03-09
- Comitter:
- mpanetta
- Date:
- Wed Mar 09 17:36:40 2016 +0000
- Commit message:
- Making Public
Changed in this revision
diff -r 000000000000 -r e6d2aeb6f9cd m3pi.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m3pi.lib Wed Mar 09 17:36:40 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/chris/code/m3pi/#4b7d6ea9b35b
diff -r 000000000000 -r e6d2aeb6f9cd main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 09 17:36:40 2016 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "m3pi.h"
+
+m3pi m3pi;
+
+// Minimum and maximum motor speeds
+#define MAX 0.5
+#define MIN 0
+
+// PID terms
+
+
+int main() {
+
+ m3pi.locate(0,1);
+ m3pi.printf("DR Floor");
+
+ wait(2.0);
+
+
+
+ float right;
+ float left;
+
+
+ float speed = MAX;
+
+
+
+
+ // Compute new speeds
+ right = speed;
+ left = speed;
+
+
+ // set speed
+ m3pi.left_motor(left);
+ m3pi.right_motor(right);
+ wait(2.3); // The value that determines the distance travelled on the first line segment
+ m3pi.left_motor(0);
+ m3pi.right_motor(0);
+ wait(0.5);
+ m3pi.left_motor(.5);
+ m3pi.right_motor(0);
+ wait(0.35); // The value that sets the angle of the turn based on time
+ m3pi.left_motor(0);
+ m3pi.right_motor(0);
+ wait(1.0);
+
+
+ m3pi.left_motor(left);
+ m3pi.right_motor(right);
+ wait(2.3); // The value that determines the distance travelled on the second line segment
+ m3pi.left_motor(0);
+ m3pi.right_motor(0);
+ wait(0.5);
+ m3pi.left_motor(.5);
+ m3pi.right_motor(0);
+ wait(0.35); // The value that sets the angle of the turn based on time
+ m3pi.left_motor(0);
+ m3pi.right_motor(0);
+ wait(1.0);
+
+ m3pi.left_motor(left);
+ m3pi.right_motor(right);
+ wait(2.25); // The value that determines the distance travelled on the third line segment
+ m3pi.left_motor(0);
+ m3pi.right_motor(0);
+
+}
+
diff -r 000000000000 -r e6d2aeb6f9cd mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 09 17:36:40 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 \ No newline at end of file