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.
Fork of Robot_Puppet_EndDevice by
Diff: main.cpp
- Revision:
- 1:06beb0d8958a
- Parent:
- 0:a66bf82d70ed
diff -r a66bf82d70ed -r 06beb0d8958a main.cpp
--- a/main.cpp Thu Apr 26 15:37:12 2018 +0000
+++ b/main.cpp Sun Apr 29 16:59:11 2018 +0000
@@ -2,8 +2,8 @@
// full reverse to full stop, dynamicaly brake and switch off.
#include "mbed.h"
#include "Motor.h"
-Motor A(p22, p6, p5); // pwm, fwd, rev, can brake
-Motor B(p21, p7, p8); // pwm, fwd, rev, can brake
+Motor B(p23, p6, p5); // pwm, fwd, rev, can brake //right?
+Motor A(p24, p7, p8); // pwm, fwd, rev, can brake //left?
//End Device Setup for XBEE End Device
@@ -13,8 +13,11 @@
//Movement Indicators
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
-DigitalOut myled3(LED2);
-DigitalOut myled4(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+//debug
+Serial pc(USBTX, USBRX);
// Default Value for command to wait
char command = 'W';
@@ -35,6 +38,9 @@
//pc.printf("Command: %c\n\r",command);
}
+// pc.printf("%c",command);
+// pc.printf("\n\r");
+
switch (command){
case 'A': // Move back speed 1
A.speed(-0.5);
@@ -45,7 +51,7 @@
myled3 = 0;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'B': // Move back speed 2
A.speed(-1);
@@ -56,7 +62,7 @@
myled3 = 0;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'C': // Move right speed 1
A.speed(0.5);
@@ -67,7 +73,7 @@
myled3 = 0;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'D': // Move right speed 2
A.speed(1);
@@ -78,7 +84,7 @@
myled3 = 0;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'E': // Move forward speed 1
A.speed(0.5);
@@ -89,7 +95,7 @@
myled3 = 1;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'F': // Move forward speed 2
A.speed(1);
@@ -100,7 +106,7 @@
myled3 = 1;
myled4 = 0;
- wait(0.5);
+ //wait(0.5);
break;
case 'G': // Move left speed 1
A.speed(0);
@@ -111,7 +117,7 @@
myled3 = 0;
myled4 = 1;
- wait(0.5);
+ //wait(0.5);
break;
case 'H': // Move left speed 2
A.speed(0);
@@ -122,29 +128,29 @@
myled3 = 0;
myled4 = 1;
- wait(0.5);
+ //wait(0.5);
break;
case 'I': // Stop
- A.speed(-0.5);
- B.speed(-0.5);
+ A.speed(0.0);
+ B.speed(0.0);
myled1 = 1;
myled2 = 1;
myled3 = 1;
myled4 = 1;
+ break;
- wait(0.5);
+ //wait(0.5);
case 'W': // Stop if nothing else is coming in
- A.speed(0);
- B.speed(0);
+ A.speed(0.0);
+ B.speed(0.0);
myled1 = 0;
myled2 = 0;
myled3 = 0;
myled4 = 0;
-
- wait(0.5);
+ //wait(0.5);
}
}
