Code For the Remote Module

Dependencies:   mbed Motor

Files at this revision

API Documentation at this revision

Comitter:
buntyshubho
Date:
Sun Feb 27 06:12:22 2011 +0000
Commit message:

Changed in this revision

Motor.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 4b7f01607612 Motor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.lib	Sun Feb 27 06:12:22 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r 4b7f01607612 main.cpp
--- /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;
+    
+   } 
+  }  
+}
diff -r 000000000000 -r 4b7f01607612 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Feb 27 06:12:22 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912