An RPC program that reads data from an Accelerometer(MMA7660) on the Mbed developement board and sends it to the PC trough a serial connection

Dependencies:   MMA7660 RPCInterface mbed

Fork of RPC_Serial by Michael Walker

Revision:
2:c079ba242f7c
Parent:
1:de34af25056a
--- a/main.cpp	Tue Aug 24 15:15:44 2010 +0000
+++ b/main.cpp	Mon Mar 10 11:49:35 2014 +0000
@@ -1,7 +1,27 @@
 #include "mbed.h"
 #include "rpc.h"
+#include "RPCVariable.h"
+//#include "LM75B.h"
+#include "MMA7660.h"
+
+
+
 Serial pc(USBTX, USBRX);
+AnalogIn pot1 (p19, "pot1");
+//LM75B tmp(p28,p27);
+MMA7660 MMA(p28, p27);
+
+//float t1;
+float x, tmpx;
+float y;
+float z;
+//RPCVariable<float>RPCtemp(&t1,"t1");
+RPCVariable<float>RPCx(&x,"x-as");
+RPCVariable<float>RPCy(&y,"y-as");
+RPCVariable<float>RPCz(&z,"z-as");
+
 int main() {
+    pc.baud(57600);
     // setup the classes that can be created dynamically
     Base::add_rpc_class<AnalogIn>();
     Base::add_rpc_class<AnalogOut>();
@@ -18,6 +38,12 @@
     // receive commands, and send back the responses
     char buf[256], outbuf[256];
     while(1) {
+        //t1 = tmp.read();
+
+        x = MMA.x();
+        y = MMA.y();
+        z = MMA.z();
+
         pc.gets(buf, 256);
         rpc(buf, outbuf); 
         pc.printf("%s\n", outbuf);