Code For the Remote Module

Dependencies:   mbed Motor

Revision:
0:4b7f01607612
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Feb 27 06:12:22 2011 +0000
@@ -0,0 +1,52 @@
+//Robot Unit with the Xbee module
+
+#include "mbed.h"
+#include "Motor.h"
+
+Serial xbee2(p9, p10);
+DigitalOut rst2(p8);
+
+Serial pc(USBTX, USBRX);
+
+DigitalOut myled2(LED3);
+DigitalOut myled1(LED4);
+
+Motor m1(p23, p11, p12); // pwm, fwd, rev //lEFT MOTOR
+Motor m2(p22, p14, p15); // pwm, fwd, rev //rIGHT MOTOR
+
+Motor m3(p23, p12, p11); // pwm, rev, fwd 
+Motor m4(p22, p15, p14); // pwm, rev, fwd
+int main() {
+    char temp = '0';
+
+    // reset the xbees (at least 200ns)
+   // rst1 = 0;
+    rst2 = 0;
+    wait_ms(1); 
+    //rst1 = 1;
+    rst2 = 1;
+    wait_ms(1); 
+ 
+     for (float s= -1.0; s < 1.0 ; s += 0.01) {
+     while(1) {
+     temp = xbee2.getc();
+     if(temp == 'C'){  //FORWARD
+        m1.speed(s); 
+        m2.speed(s);
+        wait(0.02);
+        }
+        
+         if(temp == 'D'){ //REVERSE
+        m3.speed(s); 
+        m4.speed(s);
+        wait(0.02);
+        }
+        
+                myled1 = 1;
+                wait_ms(1);
+                myled1 = 0;
+                myled2 =1;
+    
+   } 
+  }  
+}