RPC Serial for Sonar Range Sensor

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Michael Walker

Revision:
3:66aaebc365d3
Parent:
2:8c93b51b551f
--- a/main.cpp	Mon Jul 21 04:17:12 2014 +0000
+++ b/main.cpp	Mon Oct 20 15:30:55 2014 +0000
@@ -4,8 +4,11 @@
 #include "rpc.h"
 
 Serial pc(USBTX, USBRX);
-SRF05 srf(p13, p14);
-float f;
+SRF05 ultraX(p5, p6);
+SRF05 ultraY(p30, p29);
+
+float xsen;
+float ysen;
 
 
 int main() {
@@ -22,11 +25,13 @@
     Base::add_rpc_class<BusIn>();
     Base::add_rpc_class<BusInOut>();
     Base::add_rpc_class<Serial>();
-    RPCVariable<float> rpc_f(&f, "f");
+    RPCVariable<float> rpc_xsen(&xsen, "xsen");
+    RPCVariable<float> rpc_ysen(&ysen, "ysen");
     // receive commands, and send back the responses
     char buf[256], outbuf[256];
     while(1) {
-        f=srf.read();
+        xsen=ultraX.read();
+        ysen=ultraY.read();
         pc.gets(buf, 256);
         rpc(buf, outbuf); 
         pc.printf("%s\n", outbuf);