Dependencies:   mbed RFSRF05

Files at this revision

API Documentation at this revision

Comitter:
xiaxia686
Date:
Wed Mar 14 17:05:44 2012 +0000
Commit message:
code for sonar localisation on robot side

Changed in this revision

RFSRF05.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RFSRF05.lib	Wed Mar 14 17:05:44 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/xiaxia686/code/RFSRF05/#1e4910aeb884
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 14 17:05:44 2012 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "RFSRF05.h"
+
+DigitalOut Led_1(LED1);
+DigitalOut Led_2(LED2);
+
+RFSRF05 my_srf(p13,p21,p22,p23,p24,p25,p26,p5,p6,p7,p8,p9);
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+float Distance[3],Distance_Shortest,Distance_Largest;
+volatile char SendByte;
+
+int main() {
+    pc.printf("Robot Side Side \n");
+    while (1) {
+        Led_2 = 1;
+        wait_ms(100);
+        Distance[0] = my_srf.read0();
+        Distance[1] = my_srf.read1();
+        Distance[2] = my_srf.read2();
+        pc.printf("%.1f, %.1f, %.1f \n",Distance[0],Distance[1],Distance[2]);
+//        pc.printf("Distance0 = %.1f\n",Distance[0]);
+//        pc.printf("Distance1 = %.1f\n",Distance[1]);
+//        pc.printf("Distance2 = %.1f\n",Distance[2]);
+//        pc.printf("\n\r");
+        Led_2 = 0;
+        wait_ms(50);
+
+
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 14 17:05:44 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/14f4805c468c