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: QEI mbed-src-AV
Revision 2:664717ad13cc, committed 2015-11-11
- Comitter:
- jliu
- Date:
- Wed Nov 11 00:23:33 2015 +0000
- Parent:
- 1:1fed86c424fd
- Commit message:
- k
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Nov 08 01:35:36 2015 +0000
+++ b/main.cpp Wed Nov 11 00:23:33 2015 +0000
@@ -3,6 +3,11 @@
// Control with PWM.
// Test Serial Output.
+////////////////
+//SOME GLOBALS//
+////////////////
+int turn_dist = 1000;
+
#include "mbed.h"
#include "PinDefinitions.h"
@@ -56,8 +61,8 @@
void goForward(int dist)
{
- setRightPwm(0.5);
- setLeftPwm(0.45);
+ setRightPwm(1);
+ setLeftPwm(0.95);
while (Rdistance() < dist && Ldistance() < dist)
{
pc.printf("Lp: %d\nRp: %d\n\n", Ldistance(), Rdistance());
@@ -69,10 +74,8 @@
}
void turnR()
-{
- const int turn_dist = 1000;
-
- setLeftPwm(0.5);
+{
+ setLeftPwm(1);
while(Ldistance() < turn_dist)
{
pc.printf("Turning... Lp: %d\n", Ldistance());
@@ -83,10 +86,8 @@
}
void turnL()
-{
- const int turn_dist = 1000;
-
- setRightPwm(0.5);
+{
+ setRightPwm(1);
while(Rdistance() < turn_dist)
{
pc.printf("Turning... Rp: %d\n", Rdistance());